Container traits
Container
len
fn len(&const self) -> uint
Return the number of elements in the container
is_empty
fn is_empty(&const self) -> bool
Return true if the container contains no elements
Map
contains_key
fn contains_key(&self, key: &K) -> bool
Return true if the map contains a value for the specified key
each_key
fn each_key(&self, f: &fn(&K) -> bool)
Visit all keys
each_value
fn each_value(&self, f: &fn(&V) -> bool)
Visit all values
mutate_values
fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool)
Iterate over the map and mutate the contained values
find
fn find(&self, key: &K) -> Option<&'self V>
Return a reference to the value corresponding to the key
find_mut
fn find_mut(&mut self, key: &K) -> Option<&'self mut V>
Return a mutable reference to the value corresponding to the key
insert
fn insert(&mut self, key: K, value: V) -> bool
Insert a key-value pair into the map. An existing value for a key is replaced by the new value. Return true if the key did not already exist in the map.
remove
fn remove(&mut self, key: &K) -> bool
Remove a key-value pair from the map. Return true if the key was present in the map, otherwise false.
Mutable
clear
fn clear(&mut self)
Clear the container, removing all values.
Set
contains
fn contains(&self, value: &T) -> bool
Return true if the set contains a value
insert
fn insert(&mut self, value: T) -> bool
Add a value to the set. Return true if the value was not already present in the set.
remove
fn remove(&mut self, value: &T) -> bool
Remove a value from the set. Return true if the value was present in the set.
is_disjoint
fn is_disjoint(&self, other: &Self) -> bool
Return true if the set has no elements in common with other
. This is equivalent to checking for an empty intersection.
is_subset
fn is_subset(&self, other: &Self) -> bool
Return true if the set is a subset of another
is_superset
fn is_superset(&self, other: &Self) -> bool
Return true if the set is a superset of another
difference
fn difference(&self, other: &Self, f: &fn(&T) -> bool)
Visit the values representing the difference
symmetric_difference
fn symmetric_difference(&self, other: &Self, f: &fn(&T) -> bool)
Visit the values representing the symmetric difference
intersection
fn intersection(&self, other: &Self, f: &fn(&T) -> bool)
Visit the values representing the intersection
union
fn union(&self, other: &Self, f: &fn(&T) -> bool)
Visit the values representing the union