Struct collections::treemap::TreeMap
pub struct TreeMap<K, V> { // some fields omitted }
Methods
impl<K: TotalOrd, V> TreeMap<K, V>
fn new() -> TreeMap<K, V>
Create an empty TreeMap
fn iter<'a>(&'a self) -> Entries<'a, K, V>
Get a lazy iterator over the key-value pairs in the map. Requires that it be frozen (immutable).
fn rev_iter<'a>(&'a self) -> RevEntries<'a, K, V>
Get a lazy reverse iterator over the key-value pairs in the map. Requires that it be frozen (immutable).
fn mut_iter<'a>(&'a mut self) -> MutEntries<'a, K, V>
Get a lazy forward iterator over the key-value pairs in the map, with the values being mutable.
fn mut_rev_iter<'a>(&'a mut self) -> RevMutEntries<'a, K, V>
Get a lazy reverse iterator over the key-value pairs in the map, with the values being mutable.
fn move_iter(self) -> MoveEntries<K, V>
Get a lazy iterator that consumes the treemap.
impl<K: TotalOrd, V> TreeMap<K, V>
fn lower_bound<'a>(&'a self, k: &K) -> Entries<'a, K, V>
Return a lazy iterator to the first key-value pair whose key is not less than k
If all keys in map are less than k
an empty iterator is returned.
fn upper_bound<'a>(&'a self, k: &K) -> Entries<'a, K, V>
Return a lazy iterator to the first key-value pair whose key is greater than k
If all keys in map are not greater than k
an empty iterator is returned.
fn mut_lower_bound<'a>(&'a mut self, k: &K) -> MutEntries<'a, K, V>
Return a lazy value iterator to the first key-value pair (with
the value being mutable) whose key is not less than k
.
If all keys in map are less than k
an empty iterator is
returned.
fn mut_upper_bound<'a>(&'a mut self, k: &K) -> MutEntries<'a, K, V>
Return a lazy iterator to the first key-value pair (with the
value being mutable) whose key is greater than k
.
If all keys in map are not greater than k
an empty iterator
is returned.
Trait Implementations
impl<K: Eq + TotalOrd, V: Eq> Eq for TreeMap<K, V>
impl<K: Ord + TotalOrd, V: Ord> Ord for TreeMap<K, V>
fn lt(&self, other: &TreeMap<K, V>) -> bool
fn le(&self, other: &TreeMap<K, V>) -> bool
fn ge(&self, other: &TreeMap<K, V>) -> bool
fn gt(&self, other: &TreeMap<K, V>) -> bool
impl<K: TotalOrd, V> Container for TreeMap<K, V>
fn len(&self) -> uint
Return the number of elements in the map
fn is_empty(&self) -> bool
Return true if the map contains no elements
impl<K: TotalOrd, V> Mutable for TreeMap<K, V>
fn clear(&mut self)
Clear the map, removing all key-value pairs.
impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V>
fn find<'a>(&'a self, key: &K) -> Option<&'a V>
Return a reference to the value corresponding to the key
impl<K: TotalOrd, V> MutableMap<K, V> for TreeMap<K, V>
fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V>
Return a mutable reference to the value corresponding to the key
fn swap(&mut self, key: K, value: V) -> Option<V>
Insert a key-value pair from the map. If the key already had a value present in the map, that value is returned. Otherwise None is returned.
fn pop(&mut self, key: &K) -> Option<V>
Removes a key from the map, returning the value at the key if the key was previously in the map.