pub struct VacantEntry<'a, K, V> { /* private fields */ }
Implementations§
Source§impl<'a, K, V> VacantEntry<'a, K, V>
impl<'a, K, V> VacantEntry<'a, K, V>
Sourcepub fn insert(self, value: V) -> &'a mut V
pub fn insert(self, value: V) -> &'a mut V
Inserts the entry’s key and the given value into the map, and returns a mutable reference to the value.
Sourcepub fn insert_sorted(self, value: V) -> (usize, &'a mut V)where
K: Ord,
pub fn insert_sorted(self, value: V) -> (usize, &'a mut V)where
K: Ord,
Inserts the entry’s key and the given value into the map at its ordered position among sorted keys, and returns the new index and a mutable reference to the value.
If the existing keys are not already sorted, then the insertion
index is unspecified (like slice::binary_search
), but the key-value
pair is inserted at that position regardless.
Computes in O(n) time (average).
Sourcepub fn shift_insert(self, index: usize, value: V) -> &'a mut V
pub fn shift_insert(self, index: usize, value: V) -> &'a mut V
Inserts the entry’s key and the given value into the map at the given index, shifting others to the right, and returns a mutable reference to the value.
Panics if index
is out of bounds.
Computes in O(n) time (average).
Trait Implementations§
Source§impl<K: Debug, V> Debug for VacantEntry<'_, K, V>
impl<K: Debug, V> Debug for VacantEntry<'_, K, V>
Source§impl<K, V> MutableEntryKey for VacantEntry<'_, K, V>
impl<K, V> MutableEntryKey for VacantEntry<'_, K, V>
Opt-in mutable access to VacantEntry
keys.
See MutableEntryKey
for more information.
Auto Trait Implementations§
impl<'a, K, V> Freeze for VacantEntry<'a, K, V>where
K: Freeze,
impl<'a, K, V> RefUnwindSafe for VacantEntry<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V> Send for VacantEntry<'a, K, V>
impl<'a, K, V> Sync for VacantEntry<'a, K, V>
impl<'a, K, V> Unpin for VacantEntry<'a, K, V>where
K: Unpin,
impl<'a, K, V> !UnwindSafe for VacantEntry<'a, K, V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.