An ordered map and set for integer keys implemented as a radix trie

Struct TrieMap

pub struct TrieMap<T> {
    priv root: TrieNode<T>,
    priv length: uint,
}

Struct TrieSet

pub struct TrieSet {
    priv map: TrieMap<()>,
}

Implementation of Container for TrieMap<T> where <T>

Method len

fn len(&self) -> uint

Return the number of elements in the map

Method is_empty

fn is_empty(&self) -> bool

Return true if the map contains no elements

Implementation of Mutable for TrieMap<T> where <T>

Method clear

fn clear(&mut self)

Clear the map, removing all values.

Implementation of Map<uint, T> for TrieMap<T> where <T>

Method contains_key

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

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

Method find

fn find<'a>(&'a self, key: &uint) -> Option<&'a T>

Return a reference to the value corresponding to the key

Method find_mut

fn find_mut<'a>(&'a mut self, key: &uint) -> Option<&'a mut T>

Return a mutable reference to the value corresponding to the key

Method insert

fn insert(&mut self, key: uint, value: T) -> 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: &uint) -> bool

Remove a key-value pair from the map. Return true if the key was present in the map, otherwise false.

Method swap

fn swap(&mut self, key: uint, value: T) -> Option<T>

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.

Method pop

fn pop(&mut self, key: &uint) -> Option<T>

Removes a key from the map, returning the value at the key if the key was previously in the map.

Implementation for TrieMap<T> where <T>

Method new

fn new() -> TrieMap<T>

Create an empty TrieMap

Method each_reverse

fn each_reverse<'a>(&'a self, f: &fn(&uint, &'a T) -> bool) -> bool

Visit all key-value pairs in reverse order

Method each

fn each<'a>(&'a self, f: &fn(&uint, &'a T) -> bool) -> bool

Visit all key-value pairs in order

Method each_key

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

Visit all keys in order

Method each_value

fn each_value<'a>(&'a self, f: &fn(&'a T) -> bool) -> bool

Visit all values in order

Method mutate_values

fn mutate_values(&mut self, f: &fn(&uint, &mut T) -> bool) -> bool

Iterate over the map and mutate the contained values

Method each_key_reverse

fn each_key_reverse(&self, f: &fn(&uint) -> bool) -> bool

Visit all keys in reverse order

Method each_value_reverse

fn each_value_reverse(&self, f: &fn(&T) -> bool) -> bool

Visit all values in reverse order

Implementation of Container for TrieSet

Method len

fn len(&self) -> uint

Return the number of elements in the set

Method is_empty

fn is_empty(&self) -> bool

Return true if the set contains no elements

Implementation of Mutable for TrieSet

Method clear

fn clear(&mut self)

Clear the set, removing all values.

Implementation for TrieSet

Method new

fn new() -> TrieSet

Create an empty TrieSet

Method contains

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

Return true if the set contains a value

Method insert

fn insert(&mut self, value: uint) -> 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: &uint) -> bool

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

Method each

fn each(&self, f: &fn(&uint) -> bool) -> bool

Visit all values in order

Method each_reverse

fn each_reverse(&self, f: &fn(&uint) -> bool) -> bool

Visit all values in reverse order