pub enum Entry<'a, T: BiHashItem, 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 BiHashMap
.
Variants§
Vacant(VacantEntry<'a, T, S, A>)
A vacant entry: none of the provided keys are present.
Occupied(OccupiedEntry<'a, T, S, A>)
An occupied entry where at least one of the keys is present in the map.
Implementations§
Source§impl<'a, T: BiHashItem, S: Clone + BuildHasher, A: Allocator> Entry<'a, T, S, A>
impl<'a, T: BiHashItem, S: Clone + BuildHasher, A: Allocator> Entry<'a, T, S, A>
Sourcepub fn or_insert(self, default: T) -> OccupiedEntryMut<'a, T, S>
pub fn or_insert(self, default: T) -> OccupiedEntryMut<'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 BiHashMap::entry
.
Sourcepub fn or_insert_with<F: FnOnce() -> T>(
self,
default: F,
) -> OccupiedEntryMut<'a, T, S>
pub fn or_insert_with<F: FnOnce() -> T>( self, default: F, ) -> OccupiedEntryMut<'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 BiHashMap::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 occupied entries before any potential inserts into the map.
F
is called for each entry that matches the provided keys.