Rollup merge of #78083 - ChaiTRex:master, r=m-ou-se
Stabilize or_insert_with_key Stabilizes the `or_insert_with_key` feature from https://github.com/rust-lang/rust/issues/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.
This commit is contained in:
commit
0765536c0b
3 changed files with 15 additions and 11 deletions
|
@ -40,7 +40,7 @@ const SSO_ARRAY_SIZE: usize = 8;
|
|||
// into_keys/into_values (unstable)
|
||||
// all raw_entry-related
|
||||
// PartialEq/Eq (requires sorting the array)
|
||||
// Entry::or_insert_with_key (unstable)
|
||||
// Entry::or_insert_with_key
|
||||
// Vacant/Occupied entries and related
|
||||
//
|
||||
// FIXME: In HashMap most methods accepting key reference
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue