Container traits

Trait Container

Method len

fn len(&const self) -> uint

Return the number of elements in the container

Method is_empty

fn is_empty(&const self) -> bool

Return true if the container contains no elements

Trait Map

Method contains_key

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

Return true if the map contains a value for the specified key

Method each_key

fn each_key(&self, f: &fn(&K) -> bool)

Visit all keys

Method each_value

fn each_value(&self, f: &fn(&V) -> bool)

Visit all values

Method mutate_values

fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool)

Iterate over the map and mutate the contained values

Method find

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

Return a reference to the value corresponding to the key

Method find_mut

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

Return a mutable reference to the value corresponding to the key

Method 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.

Method 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.

Trait Mutable

Method clear

fn clear(&mut self)

Clear the container, removing all values.

Trait Set

Method contains

fn contains(&self, value: &T) -> bool

Return true if the set contains a value

Method 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.

Method remove

fn remove(&mut self, value: &T) -> bool

Remove a value from the set. Return true if the value was present in the set.

Method 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.

Method is_subset

fn is_subset(&self, other: &Self) -> bool

Return true if the set is a subset of another

Method is_superset

fn is_superset(&self, other: &Self) -> bool

Return true if the set is a superset of another

Method difference

fn difference(&self, other: &Self, f: &fn(&T) -> bool)

Visit the values representing the difference

Method symmetric_difference

fn symmetric_difference(&self, other: &Self, f: &fn(&T) -> bool)

Visit the values representing the symmetric difference

Method intersection

fn intersection(&self, other: &Self, f: &fn(&T) -> bool)

Visit the values representing the intersection

Method union

fn union(&self, other: &Self, f: &fn(&T) -> bool)

Visit the values representing the union