Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Stabilize or_insert_with_key #78083
Stabilize or_insert_with_key #78083
Conversation
|
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
|
This will needs a libs team sign-off. r? @SimonSapin |
|
@rfcbot merge |
|
Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
|
Sorry for the delay! Unfortunately this missed 1.49. Can you update the stable versions to 1.50? |
|
@m-ou-se It is updated in the latest commit. |
This seems like a useful bit of information that would be good to add to the docs. |
|
@BurntSushi How about this?
|
|
@ChaiTRex Thank you, that looks great to me! |
|
|
Stabilizes the
or_insert_with_keyfeature from #71024. This allows inserting key-derived values when aHashMap/BTreeMapentry is vacant.The difference between this and
.or_insert_with(|| ... )is that this provides a reference to the key to the closure after it is moved with.entry(key_being_moved), avoiding the need to copy or clone the key.