Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for indexmap #431

Merged
merged 1 commit into from
Apr 12, 2022
Merged

Conversation

jgrund
Copy link
Contributor

@jgrund jgrund commented Apr 11, 2022

Add optional support for indexmap to

  • sets_duplicate_value_is_error
  • maps_duplicate_key_is_error
  • sets_last_value_wins

Signed-off-by: Joe Grund jgrund@whamcloud.io

Add optional support for `indexmap` to

- `sets_duplicate_value_is_error`
- `maps_duplicate_key_is_error`
- `sets_last_value_wins`

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
@@ -41,6 +42,7 @@ rustversion = "1.0.0"
serde = {version = "1.0.122", features = ["derive"]}
serde_json = {version = "1.0.1", optional = true}
serde_with_macros = {path = "../serde_with_macros", version = "1.5.0", optional = true}
indexmap_crate = {package = "indexmap", version = "1.8", optional = true}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The dependencies are written in sorted order. Not a problem, though.

@jonasbb
Copy link
Owner

jonasbb commented Apr 11, 2022

Hi, thanks for the contribution. I gladly merge indexmap support.
Do you also care about the serde_as transformations? These two links should show what I mean:

You could replace #[serde(with = "indexmap::serde_seq")] with #[serde_as(as = "Vec<(_, _)>"], except that you can also control how the key/values are serialized. The matching implementations are in src/{de,ser}/impls.rs. No problem if you cannot add it.

@jgrund
Copy link
Contributor Author

jgrund commented Apr 12, 2022

You could replace #[serde(with = "indexmap::serde_seq")] with #[serde_as(as = "Vec<(_, _)>"], except that you can also control how the key/values are serialized. The matching implementations are in src/{de,ser}/impls.rs. No problem if you cannot add it.

Can I try this in followup PR?

@jonasbb
Copy link
Owner

jonasbb commented Apr 12, 2022

Can I try this in followup PR?

Sure, follow-ups welcome :) I will merge this but wait a little bit before releasing a new version.

bors merge

@bors
Copy link
Contributor

bors bot commented Apr 12, 2022

Build succeeded:

@bors bors bot merged commit f615815 into jonasbb:master Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants