pub enum Entry<'a, K1, K2, V> {
Occupied(OccupiedEntry<'a, K1, K2, V>),
Vacant(VacantEntry<'a, K1, K2, V>),
}Expand description
A view into a single entry in a DoubleMap, which may be
either vacant or occupied.
Variants§
Occupied(OccupiedEntry<'a, K1, K2, V>)
Both provided keys identify the same existing entry.
Vacant(VacantEntry<'a, K1, K2, V>)
Neither of the provided keys is present — a new entry can be inserted.
Implementations§
Source§impl<'a, K1, K2, V> Entry<'a, K1, K2, V>
impl<'a, K1, K2, V> Entry<'a, K1, K2, 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 default if vacant, and returns
a mutable reference to the value.
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 default if
vacant, and returns a mutable reference to the value.
Sourcepub fn or_insert_with_keys<F>(self, default: F) -> &'a mut V
pub fn or_insert_with_keys<F>(self, default: F) -> &'a mut V
Ensures a value is in the entry by inserting the result of default if
vacant, and returns a mutable reference to the value. The default closure
receives references to the keys of the entry.
Sourcepub fn and_modify<F>(self, f: F) -> Self
pub fn and_modify<F>(self, f: F) -> Self
Provides in-place mutation of an occupied entry before any potential insertion, then returns the entry unchanged for further chaining.
Sourcepub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K1, K2, V>
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K1, K2, V>
Sets the value of the entry, and returns an OccupiedEntry.
Sourcepub fn or_default(self) -> &'a mut Vwhere
V: Default,
pub fn or_default(self) -> &'a mut Vwhere
V: Default,
Ensures a value is in the entry by inserting the default value if vacant.