pub struct EventIdMapEntry<'a, E: Borrow<EventId>, V>(/* private fields */);Expand description
A view into a single entry in an EventIdMap.
Implementations§
Source§impl<'a, E: Borrow<EventId>, V> EventIdMapEntry<'a, E, V>
impl<'a, E: Borrow<EventId>, V> EventIdMapEntry<'a, E, 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 default if empty, and returns a mutable reference to the value in the entry.
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
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.
Sourcepub fn or_insert_with_key<F: FnOnce(&E) -> V>(self, default: F) -> &'a mut V
pub fn or_insert_with_key<F: FnOnce(&E) -> V>(self, default: F) -> &'a mut V
Ensures a value is in the entry by inserting, if empty, the result of the default function.
This method allows for generating key-derived values for insertion by providing the default function a reference to the key that was moved during the .entry(key) method call.
Sourcepub fn insert_entry(self, value: V) -> &'a mut V
pub fn insert_entry(self, value: V) -> &'a mut V
Sets the value of the entry, and returns a mutable reference to the value.
Source§impl<'a, E: Borrow<EventId>, V: Default> EventIdMapEntry<'a, E, V>
impl<'a, E: Borrow<EventId>, V: Default> EventIdMapEntry<'a, E, V>
Sourcepub fn or_default(self) -> &'a mut V
pub fn or_default(self) -> &'a mut V
Ensures a value is in the entry by inserting the default value if empty, and returns a mutable reference to the value in the entry.