pub struct EdgeHashMap<'a, M: Manager, V, S> { /* private fields */ }
Expand description
Implementations§
Source§impl<'a, M: Manager, V, S: Default + BuildHasher> EdgeHashMap<'a, M, V, S>
impl<'a, M: Manager, V, S: Default + BuildHasher> EdgeHashMap<'a, M, V, S>
Sourcepub fn with_capacity(manager: &'a M, capacity: usize) -> Self
pub fn with_capacity(manager: &'a M, capacity: usize) -> Self
Create a new edge map with capacity
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more elements
The collection may reserve more space to speculatively avoid frequent
reallocations. After calling reserve()
, the capacity will be greater
than or equal to self.len() + additional
. Does nothing if capacity is
already sufficient.
§Panics
Panics if the new allocation size overflows usize
.
Sourcepub fn get(&self, key: &M::Edge) -> Option<&V>
pub fn get(&self, key: &M::Edge) -> Option<&V>
Get a reference to the value for edge
(if present)
Sourcepub fn get_mut(&mut self, key: &M::Edge) -> Option<&mut V>
pub fn get_mut(&mut self, key: &M::Edge) -> Option<&mut V>
Get a mutable reference to the value for edge
(if present)
Sourcepub fn insert(&mut self, key: &M::Edge, value: V) -> Option<V>
pub fn insert(&mut self, key: &M::Edge, value: V) -> Option<V>
Insert a key-value pair into the map
If the map did not have this key present, the key is cloned, and None
is returned. If the map did have this key present, the value is updated,
and the old value is returned.
Sourcepub fn remove(&mut self, key: &M::Edge) -> Option<V>
pub fn remove(&mut self, key: &M::Edge) -> Option<V>
Remove the entry for the given key (if present)
Returns the value that was previously stored in the map, or None
,
respectively.