11

Stabilize or_insert_with_key by ChaiTRex · Pull Request #78083 · rust-lang/rust...

 3 years ago
source link: https://github.com/rust-lang/rust/pull/78083
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Contributor

ChaiTRex commented on Oct 19

Stabilizes the or_insert_with_key feature from #71024. This allows inserting key-derived values when a HashMap/BTreeMap entry 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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK