Trait collections_rs::Map
[−]
[src]
pub trait Map<'m, K: 'm, V: 'm> { type Keys: Iterator<Item = &'m K>; type Values: Iterator<Item = &'m V>; type ValuesMut: Iterator<Item = &'m mut V>; type Iter: Iterator<Item = (&'m K, &'m V)>; type IterMut: Iterator<Item = (&'m K, &'m mut V)>; fn keys(&'m self) -> Self::Keys; fn values(&'m self) -> Self::Values; fn values_mut(&'m mut self) -> Self::ValuesMut; fn iter(&'m self) -> Self::Iter; fn iter_mut(&'m mut self) -> Self::IterMut; fn get(&'m self, key: &K) -> Option<&'m V>; fn get_mut(&'m mut self, key: &K) -> Option<&'m mut V>; fn insert(&'m mut self, key: K, value: V) -> Option<(K, V)>; fn remove(&'m mut self, key: &K) -> Option<(K, V)>; fn contains_key(&'m self, key: &K) -> bool { ... } }
A map associating keys with values.
Associated Types
type Keys: Iterator<Item = &'m K>
type Values: Iterator<Item = &'m V>
type ValuesMut: Iterator<Item = &'m mut V>
type Iter: Iterator<Item = (&'m K, &'m V)>
type IterMut: Iterator<Item = (&'m K, &'m mut V)>
Required Methods
fn keys(&'m self) -> Self::Keys
Returns an iterator over all keys in this Map
.
fn values(&'m self) -> Self::Values
Returns an iterator over all values in this Map
.
fn values_mut(&'m mut self) -> Self::ValuesMut
Returns an iterator over mutable borrows to all values in this Map
.
fn iter(&'m self) -> Self::Iter
Returns an iterator over all keys and their values in this Map
.
fn iter_mut(&'m mut self) -> Self::IterMut
Returns an iterator over all keys and their values as mutable borrows.
fn get(&'m self, key: &K) -> Option<&'m V>
Borrows value from its key.
fn get_mut(&'m mut self, key: &K) -> Option<&'m mut V>
Borrows a value mutably from its key.
fn insert(&'m mut self, key: K, value: V) -> Option<(K, V)>
Inserts a value into this Map
. If the key was already used, it
returns the old key and value pair.
fn remove(&'m mut self, key: &K) -> Option<(K, V)>
Removes a value from this Map
, returning it.
Provided Methods
fn contains_key(&'m self, key: &K) -> bool
Checks whether this Map
contains a value at the key.