[][src]Trait containers_rs::CopyMap

pub trait CopyMap<'a, K, V, E = (K, V), R = &'a V, Rm = &'a mut V>: Container<E> where
    Self: 'a,
    K: Copy + Eq,
    V: 'a,
    R: Deref<Target = V>,
    Rm: DerefMut<Target = V>, 
{ fn get(&'a self, key: K) -> Option<R>;
fn get_mut(&'a mut self, key: K) -> Option<Rm>;
fn insert(&mut self, k: K, v: V) -> Option<V>; }

Trait for a container indexed by a value that implements Copy and Eq.

Required methods

fn get(&'a self, key: K) -> Option<R>

Get a value from this Map. Takes a key by reference and returns a reference to the corresponding data, or None if none exists.

fn get_mut(&'a mut self, key: K) -> Option<Rm>

Returns a mutable reference to an object stored in this container based on the key given, or None if the key does not exist.

fn insert(&mut self, k: K, v: V) -> Option<V>

Adds a new item into this container with the associated key, and returns the previous value associated with that key, if it existed.

Loading content...

Implementors

Loading content...