Trait rs_graph::collections::ItemMap
source · pub trait ItemMap<K, V>where
K: Copy,{
// Required methods
fn len(&self) -> usize;
fn clear(&mut self);
fn insert(&mut self, key: K, value: V) -> bool;
fn insert_or_replace(&mut self, key: K, value: V) -> bool;
fn remove(&mut self, key: K) -> bool;
fn get(&self, key: K) -> Option<&V>;
fn get_mut(&mut self, key: K) -> Option<&mut V>;
fn contains(&self, key: K) -> bool;
// Provided method
fn is_empty(&self) -> bool { ... }
}
Expand description
A (finite) map of items (node or edges) of a graph to some value.
Required Methods§
sourcefn insert(&mut self, key: K, value: V) -> bool
fn insert(&mut self, key: K, value: V) -> bool
Add one item to the map.
Return true
iff u
had not been contained in this map before. Otherwise
case the value is not updated.
sourcefn insert_or_replace(&mut self, key: K, value: V) -> bool
fn insert_or_replace(&mut self, key: K, value: V) -> bool
Add one item to the map.
Return true
iff key
had not been contained in this map before. In this
case the value is updated.
sourcefn remove(&mut self, key: K) -> bool
fn remove(&mut self, key: K) -> bool
Remove one item from the map.
Returns true
if the item had been contained in the map, otherwise
false.
sourcefn get(&self, key: K) -> Option<&V>
fn get(&self, key: K) -> Option<&V>
Return a read-only reference to the element with the given key.