pub enum Entry<'a, V> {
Occupied(OccupiedEntry<'a, V>),
Vacant(VacantEntry<'a, V>),
}Expand description
A place in the map, whether or not something is there yet.
Returned by OrderedMap::entry.
Variants§
Occupied(OccupiedEntry<'a, V>)
The key is present.
Vacant(VacantEntry<'a, V>)
The key is absent, and the entry owns the key that would go there.
Implementations§
Source§impl<'a, V> Entry<'a, V>
impl<'a, V> Entry<'a, V>
Sourcepub fn or_insert(self, default: V) -> &'a mut V
pub fn or_insert(self, default: V) -> &'a mut V
The value, inserting default first if the key was absent.
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
The value, inserting what default returns if the key was absent.
default is not called for a key that is already there.
Sourcepub fn and_modify<F: FnOnce(&mut V)>(self, f: F) -> Self
pub fn and_modify<F: FnOnce(&mut V)>(self, f: F) -> Self
Run f on the value if the key is present, then hand the entry back.
Auto Trait Implementations§
impl<'a, V> !UnwindSafe for Entry<'a, V>
impl<'a, V> Freeze for Entry<'a, V>
impl<'a, V> RefUnwindSafe for Entry<'a, V>
impl<'a, V> Send for Entry<'a, V>
impl<'a, V> Sync for Entry<'a, V>
impl<'a, V> Unpin for Entry<'a, V>
impl<'a, V> UnsafeUnpin for Entry<'a, 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