[src]

Struct collections::smallintmap::SmallIntMap

pub struct SmallIntMap<T> {
    // some fields omitted
}

Methods

impl<V> SmallIntMap<V>

fn new() -> SmallIntMap<V>

Create an empty SmallIntMap

fn get<'a>(&'a self, key: &uint) -> &'a V

fn iter<'r>(&'r self) -> Entries<'r, V>

An iterator visiting all key-value pairs in ascending order by the keys. Iterator element type is (uint, &'r V)

fn mut_iter<'r>(&'r mut self) -> MutEntries<'r, V>

An iterator visiting all key-value pairs in ascending order by the keys, with mutable references to the values Iterator element type is (uint, &'r mut V)

fn rev_iter<'r>(&'r self) -> RevEntries<'r, V>

An iterator visiting all key-value pairs in descending order by the keys. Iterator element type is (uint, &'r V)

fn mut_rev_iter<'r>(&'r mut self) -> RevMutEntries<'r, V>

An iterator visiting all key-value pairs in descending order by the keys, with mutable references to the values Iterator element type is (uint, &'r mut V)

fn move_iter(&mut self) -> FilterMap<(uint, Option<V>), (uint, V), Enumerate<MoveItems<Option<V>>>>

Empties the hash map, moving all values into the specified closure

impl<V: Clone> SmallIntMap<V>

fn update_with_key(&mut self, key: uint, val: V, ff: |uint, V, V| -> V) -> bool

fn update(&mut self, key: uint, newval: V, ff: |V, V| -> V) -> bool

Trait Implementations

impl<V> Container for SmallIntMap<V>

fn len(&self) -> uint

Return the number of elements in the map

fn is_empty(&self) -> bool

Return true if there are no elements in the map

impl<V> Mutable for SmallIntMap<V>

fn clear(&mut self)

Clear the map, removing all key-value pairs.

impl<V> Map<uint, V> for SmallIntMap<V>

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

Return a reference to the value corresponding to the key

impl<V> MutableMap<uint, V> for SmallIntMap<V>

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

Return a mutable reference to the value corresponding to the key

fn insert(&mut self, key: uint, 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.

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.

fn swap(&mut self, key: uint, 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: &uint) -> Option<V>

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