pub struct VacantEntry<'a, K: 'a, V: 'a> { /* private fields */ }Expand description
A view into a vacant entry in a HashMap.
It is part of the Entry enum.
Implementations§
Source§impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V>
impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V>
1.10.0 · Sourcepub fn key(&self) -> &K
pub fn key(&self) -> &K
Gets a reference to the key that would be used when inserting a value
through the VacantEntry.
§Examples
1.0.0 · Sourcepub fn insert(self, value: V) -> &'a mut V
pub fn insert(self, value: V) -> &'a mut V
Sets the value of the entry with the VacantEntry’s key,
and returns a mutable reference to it.
§Examples
1.83.0 · Sourcepub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V>
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V>
Sets the value of the entry with the VacantEntry’s key,
and returns an OccupiedEntry.