pub enum Entry<'a, T: IdHashItem, S = DefaultHashBuilder, A: Allocator = Global> {
Vacant(VacantEntry<'a, T, S, A>),
Occupied(OccupiedEntry<'a, T, S, A>),
}
Expand description
An implementation of the Entry API for IdHashMap
.
Variants§
Vacant(VacantEntry<'a, T, S, A>)
A vacant entry.
Occupied(OccupiedEntry<'a, T, S, A>)
An occupied entry.
Implementations§
Source§impl<'a, T: IdHashItem, S: Clone + BuildHasher, A: Allocator> Entry<'a, T, S, A>
impl<'a, T: IdHashItem, S: Clone + BuildHasher, A: Allocator> Entry<'a, T, S, A>
Sourcepub fn or_insert(self, default: T) -> RefMut<'a, T, S>
pub fn or_insert(self, default: T) -> RefMut<'a, T, S>
Ensures a value is in the entry by inserting the default if empty, and returns a mutable reference to the value in the entry.
§Panics
Panics if the key hashes to a different value than the one passed
into IdHashMap::entry
.
Sourcepub fn or_insert_with<F: FnOnce() -> T>(self, default: F) -> RefMut<'a, T, S>
pub fn or_insert_with<F: FnOnce() -> T>(self, default: F) -> RefMut<'a, T, S>
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.
§Panics
Panics if the key hashes to a different value than the one passed
into IdHashMap::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, T, S, A> Freeze for Entry<'a, T, S, A>where
S: Freeze,
impl<'a, T, S, A> RefUnwindSafe for Entry<'a, T, S, A>
impl<'a, T, S, A> Send for Entry<'a, T, S, A>
impl<'a, T, S, A> Sync for Entry<'a, T, S, A>
impl<'a, T, S, A> Unpin for Entry<'a, T, S, A>where
S: Unpin,
impl<'a, T, S = RandomState, A = Global> !UnwindSafe for Entry<'a, T, S, A>
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