pub enum Entry<'a, K: 'a + WeakKey, V: 'a> {
Occupied(OccupiedEntry<'a, K, V>),
Vacant(VacantEntry<'a, K, V>),
}
Expand description
Represents an entry in the table which may be occupied or vacant.
Variants§
Occupied(OccupiedEntry<'a, K, V>)
Vacant(VacantEntry<'a, K, V>)
Implementations§
Source§impl<'a, K: WeakKey, V> Entry<'a, K, V>
impl<'a, K: WeakKey, V> Entry<'a, K, V>
Sourcepub fn or_insert(self, default: V) -> &'a mut V
pub fn or_insert(self, default: V) -> &'a mut V
Ensures a value is in the entry by inserting a default value if empty, and returns a mutable reference to the value in the entry.
O(1) time
Sourcepub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V
Ensures a value is in the entry by inserting the result of the default function if empty, and returns a mutable reference to the value in the entry.
O(1) time
Trait Implementations§
Auto Trait Implementations§
impl<'a, K, V> Freeze for Entry<'a, K, V>
impl<'a, K, V> RefUnwindSafe for Entry<'a, K, V>
impl<'a, K, V> Send for Entry<'a, K, V>
impl<'a, K, V> Sync for Entry<'a, K, V>
impl<'a, K, V> Unpin for Entry<'a, K, V>
impl<'a, K, V> !UnwindSafe for Entry<'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