pub struct VacantEntry<'a, K: 'a + WeakKey, V: 'a>(/* private fields */);Expand description
A vacant entry, which can be inserted in or viewed.
Implementations§
Source§impl<'a, K: WeakKey, V> VacantEntry<'a, K, V>
impl<'a, K: WeakKey, V> VacantEntry<'a, K, V>
Sourcepub fn key(&self) -> &K::Strong
pub fn key(&self) -> &K::Strong
Gets a reference to the key that would be used when inserting a
value through the VacantEntry.
O(1) time
Sourcepub fn insert(self, value: V) -> &'a mut V
pub fn insert(self, value: V) -> &'a mut V
Inserts the key and value into the map and return a mutable reference to the value.
expected O(1) time; worst-case O(p) time
Sourcepub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V>
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V>
Inserts the key and value into the map, returning an OccupiedEntry.
O(1) time
Trait Implementations§
Auto Trait Implementations§
impl<'a, K, V> !UnwindSafe for VacantEntry<'a, K, V>
impl<'a, K, V> Freeze for VacantEntry<'a, K, V>
impl<'a, K, V> RefUnwindSafe for VacantEntry<'a, K, V>
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>
impl<'a, K, V> UnsafeUnpin 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
Mutably borrows from an owned value. Read more