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§

source

fn len(&self) -> usize

Return the number of items in this map.

source

fn clear(&mut self)

Remove all items from the map.

source

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.

source

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.

source

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.

source

fn get(&self, key: K) -> Option<&V>

Return a read-only reference to the element with the given key.

source

fn get_mut(&mut self, key: K) -> Option<&mut V>

Return a mutable reference to the element with the given key.

source

fn contains(&self, key: K) -> bool

Return true iff item u is contained in this map.

Provided Methods§

source

fn is_empty(&self) -> bool

Return true if this map is empty.

Implementations on Foreign Types§

source§

impl<K, V, S> ItemMap<K, V> for HashMap<K, V, S>where K: Copy + Eq + Hash, S: BuildHasher,

source§

fn is_empty(&self) -> bool

source§

fn len(&self) -> usize

source§

fn clear(&mut self)

source§

fn insert(&mut self, key: K, value: V) -> bool

source§

fn insert_or_replace(&mut self, key: K, value: V) -> bool

source§

fn remove(&mut self, key: K) -> bool

source§

fn get(&self, key: K) -> Option<&V>

source§

fn get_mut(&mut self, key: K) -> Option<&mut V>

source§

fn contains(&self, key: K) -> bool

source§

impl<'a, K, V, S> ItemMap<K, V> for &'a mut Swhere K: Copy, S: ItemMap<K, V>,

source§

fn is_empty(&self) -> bool

source§

fn len(&self) -> usize

source§

fn clear(&mut self)

source§

fn insert(&mut self, key: K, value: V) -> bool

source§

fn insert_or_replace(&mut self, key: K, value: V) -> bool

source§

fn remove(&mut self, key: K) -> bool

source§

fn get(&self, key: K) -> Option<&V>

source§

fn get_mut(&mut self, key: K) -> Option<&mut V>

source§

fn contains(&self, key: K) -> bool

Implementors§

source§

impl<'a, G, V> ItemMap<<G as GraphType>::Node<'a>, V> for NodeVecMap<'a, G, V>where G: IndexGraph, V: Clone,