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 Map::get_key_value method. #821

Merged
merged 2 commits into from
Nov 17, 2021

Conversation

timothee-haudebourg
Copy link

I have added the get_key_value method to the Map type. This is useful to get a reference to the matched key that lives as long as the map.

@timothee-haudebourg
Copy link
Author

Checks are not done yet, but I suspect it will fail with Rust below 1.40 where the get_key_value has been introduced in the standard library... Is backward compatibility below 1.40 a hard requirement?

@timothee-haudebourg
Copy link
Author

I see you already use a configuration predicate called no_btreemap_get_key_value to use the get_key_value in Map::remove_entry. That would allow me to implement the get_key_value method only when it is available in the inner implementation, but I don't know anything about no_btreemap_get_key_value. Where is it defined?

@timothee-haudebourg
Copy link
Author

So it works using no_btreemap_get_key_value, even though I don't know where this predicate is defined.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thanks!

@dtolnay dtolnay merged commit 584f476 into serde-rs:master Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants