pub enum Entry<'a, K, V, S = RandomState> {
Occupied(OccupiedEntry<'a, K, V, S>),
Vacant(VacantEntry<'a, K, V, S>),
}Expand description
A view into a single entry in a map, similar to
std::collections::hash_map::Entry.
Variants§
Occupied(OccupiedEntry<'a, K, V, S>)
Vacant(VacantEntry<'a, K, V, S>)
Implementations§
Source§impl<'a, K, V, S> Entry<'a, K, V, S>
impl<'a, K, V, S> Entry<'a, K, V, S>
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 default if vacant,
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 default
if vacant, and returns a mutable reference to the value in the entry.
Sourcepub fn or_default(self) -> &'a mut Vwhere
V: Default,
pub fn or_default(self) -> &'a mut Vwhere
V: Default,
Ensures a value is in the entry by inserting Default::default
if vacant, 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 insertion.
Trait Implementations§
impl<K: Send, V: Send, S: Send> Send for Entry<'_, K, V, S>
impl<K: Sync, V: Sync, S: Sync> Sync for Entry<'_, K, V, S>
Auto Trait Implementations§
impl<'a, K, V, S> Freeze for Entry<'a, K, V, S>where
K: Freeze,
impl<'a, K, V, S> RefUnwindSafe for Entry<'a, K, V, S>
impl<'a, K, V, S> Unpin for Entry<'a, K, V, S>where
K: Unpin,
impl<'a, K, V, S> UnsafeUnpin for Entry<'a, K, V, S>where
K: UnsafeUnpin,
impl<'a, K, V, S = RandomState> !UnwindSafe for Entry<'a, K, V, S>
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