pub enum Entry<'a, A: Array, K> {
Occupied(OccupiedEntry<'a, A>),
Vacant(VacantEntry<'a, A, K>),
}Expand description
A view into a single entry in a set, which may either be vacant or occupied.
This enum is constructed from the entry method on SmallOrdSet.
Variants§
Implementations§
Source§impl<'a, A, K, V> Entry<'a, A, K>
impl<'a, A, K, V> Entry<'a, A, K>
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>(self, f: F) -> Self
pub fn and_modify<F>(self, f: F) -> Self
Provides in-place mutable access to an occupied entry before any potential inserts into the map.
Trait Implementations§
Auto Trait Implementations§
impl<'a, A, K> !UnwindSafe for Entry<'a, A, K>
impl<'a, A, K> Freeze for Entry<'a, A, K>where
K: Freeze,
impl<'a, A, K> RefUnwindSafe for Entry<'a, A, K>
impl<'a, A, K> Send for Entry<'a, A, K>
impl<'a, A, K> Sync for Entry<'a, A, K>
impl<'a, A, K> Unpin for Entry<'a, A, K>where
K: Unpin,
impl<'a, A, K> UnsafeUnpin for Entry<'a, A, K>where
K: UnsafeUnpin,
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