pub enum Entry<'a, K: IntKey, V: 'a> {
Occupied(OccupiedEntry<'a, K, V>),
Vacant(VacantEntry<'a, K, V>),
}
Expand description
A view into a single entry in a IntMap
, which may either be vacant or occupied.
The entry can be constructed by calling IntMap::entry
with a key. It allows inspection
and in-place manipulation of its value without repeated lookups.
Variants§
Occupied(OccupiedEntry<'a, K, V>)
The entry is occupied.
Vacant(VacantEntry<'a, K, V>)
The entry is vacant.
Implementations§
Source§impl<'a, K: IntKey, V> Entry<'a, K, V>
impl<'a, K: IntKey, V> Entry<'a, K, 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 provided value if empty, and returns a mutable reference to the value in the entry.
Sourcepub fn or_insert_with<F>(self, default: F) -> &'a mut Vwhere
F: FnOnce() -> V,
pub fn or_insert_with<F>(self, default: F) -> &'a mut Vwhere
F: FnOnce() -> V,
Ensures a value is in the entry by inserting the result of the provided function if empty, and returns a mutable reference to the value in the entry.
Sourcepub fn or_insert_with_key<F>(self, default: F) -> &'a mut Vwhere
F: FnOnce(K) -> V,
pub fn or_insert_with_key<F>(self, default: F) -> &'a mut Vwhere
F: FnOnce(K) -> V,
Ensures a value is in the entry by inserting, if empty, the result of the provided function.
Auto Trait Implementations§
impl<'a, K, V> Freeze for Entry<'a, K, V>where
K: Freeze,
impl<'a, K, V> RefUnwindSafe for Entry<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V> Send for Entry<'a, K, V>
impl<'a, K, V> Sync for Entry<'a, K, V>
impl<'a, K, V> Unpin for Entry<'a, K, V>where
K: Unpin,
impl<'a, K, V> !UnwindSafe for Entry<'a, K, 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