pub enum Entry<'a, K: 'a, V: 'a, S: 'a> {
Occupied(Occupied<'a, K, V, S>),
Vacant(Vacant<'a, K, V, S>),
}Expand description
A map’s entry.
Variants§
Occupied(Occupied<'a, K, V, S>)
An occupied entry.
Vacant(Vacant<'a, K, V, S>)
A vacant (empty) entry.
Implementations§
Source§impl<'a, K, V: 'a, S> Entry<'a, K, V, S>
impl<'a, K, V: 'a, S> Entry<'a, K, V, S>
Sourcepub fn or_insert(self, value: V) -> &'a mut V
pub fn or_insert(self, value: V) -> &'a mut V
Returns a mutable reference to a value if the entry exists, or creates a new entry using a given closure if it doesn’t exist yet and returns a reference to a newly created entry’s value.
Sourcepub fn or_insert_with<F>(self, f: F) -> &'a mut Vwhere
F: FnOnce() -> V,
pub fn or_insert_with<F>(self, f: F) -> &'a mut Vwhere
F: FnOnce() -> V,
Returns a mutable reference to a value if the entry exists, or creates a new entry with a given value if it doesn’t exist yet and returns a reference to a newly created entry’s value.
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> Send for Entry<'a, K, V, S>
impl<'a, K, V, S> Sync 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> !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