[][src]Trait heaparray::CopyMap

pub trait CopyMap<K, V>: Container where
    K: Copy + Eq
{ fn get(&self, key: K) -> Option<&V>;
fn get_mut(&mut self, key: K) -> Option<&mut V>;
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(&self, key: K) -> Option<&V>

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(&mut self, key: K) -> Option<&mut V>

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

impl<A, R, E, L> CopyMap<usize, E> for RcArray<A, R, E, L> where
    A: LabelledArray<E, R> + BaseArrayRef,
    R: RefCounter<L>, 
[src]

fn get(&self, key: usize) -> Option<&E>[src]

Get a reference into this array. Returns None if:

  • The index given is out-of-bounds

fn get_mut(&mut self, key: usize) -> Option<&mut E>[src]

Get a mutable reference into this array. Returns None if:

  • The array is referenced by another pointer
  • The index given is out-of-bounds

fn insert(&mut self, key: usize, value: E) -> Option<E>[src]

Insert an element into this array. Returns None if:

  • The array is referenced by another pointer
  • The index given is out-of-bounds
  • There was nothing in the slot previously

impl<E, L> CopyMap<usize, E> for AtomicPtrArray<E, L>[src]

impl<E, L> CopyMap<usize, E> for ThinPtrArray<E, L>[src]

impl<E, L> CopyMap<usize, E> for FatPtrArray<E, L>[src]

Loading content...