pub enum Entry<'a, IDX, V> {
Vacant(VacantEntry<'a, IDX, V>),
Occupied(OccupiedEntry<'a, IDX, V>),
}
Expand description
Variants§
Vacant(VacantEntry<'a, IDX, V>)
A vacant entry.
Occupied(OccupiedEntry<'a, IDX, V>)
An occupied entry.
Implementations§
Source§impl<'a, IDX, V> Entry<'a, IDX, V>
impl<'a, IDX, V> Entry<'a, IDX, 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 the default if empty, and returns a mutable reference to the value in the entry.
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.
Sourcepub fn and_modify<F: FnOnce(&mut V)>(self, f: F) -> Self
pub fn and_modify<F: FnOnce(&mut V)>(self, f: F) -> Self
Provides in-place mutable access to an occupied entry before any potential inserts into the map.
Auto Trait Implementations§
impl<'a, IDX, V> Freeze for Entry<'a, IDX, V>
impl<'a, IDX, V> RefUnwindSafe for Entry<'a, IDX, V>where
IDX: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, IDX, V> Send for Entry<'a, IDX, V>
impl<'a, IDX, V> Sync for Entry<'a, IDX, V>
impl<'a, IDX, V> Unpin for Entry<'a, IDX, V>where
IDX: Unpin,
impl<'a, IDX, V> !UnwindSafe for Entry<'a, IDX, 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