Enum sentry::protocol::map::Entry
[−]
pub enum Entry<'a, K, V, S = RandomState> where
K: 'a,
S: 'a,
V: 'a, { Occupied(OccupiedEntry<'a, K, V, S>), Vacant(VacantEntry<'a, K, V, S>), }
A view into a single location in a map, which may be vacant or occupied.
Variants
Occupied(OccupiedEntry<'a, K, V, S>)
An occupied Entry.
Vacant(VacantEntry<'a, K, V, S>)
A vacant Entry.
Methods
impl<'a, K, V, S> Entry<'a, K, V, S> where
K: Eq + Hash,
S: BuildHasher,
K: Eq + Hash,
S: BuildHasher,
ⓘImportant traits for &'a mut Wpub fn key(&self) -> &K
ⓘImportant traits for &'a mut W
Returns the entry key
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::<String, u32>::new(); assert_eq!("hello", map.entry("hello".to_string()).key());
ⓘImportant traits for &'a mut Wpub fn or_insert(self, default: V) -> &'a mut V
ⓘImportant traits for &'a mut W
Ensures a value is in the entry by inserting the default if empty, and returns a mutable reference to the value in the entry.
ⓘImportant traits for &'a mut Wpub fn or_insert_with<F>(self, default: F) -> &'a mut V where
F: FnOnce() -> V,
ⓘImportant traits for &'a mut W
F: FnOnce() -> 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.