A map type

Type HashMap

type HashMap<K: Eq IterBytes Hash, V> = chained::T<K, V>

Type Set

type Set<K: Eq IterBytes Hash> = HashMap<K, ()>

A convenience type to treat a hashmap as a set

Interface Map

Method size

fn size() -> uint

Return the number of elements in the map

Method insert

fn insert(v: K, v: V) -> bool

Add a value to the map.

If the map already contains a value for the specified key then the original value is replaced.

Returns true if the key did not already exist in the map

Method contains_key

fn contains_key(key: K) -> bool

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

Method contains_key_ref

fn contains_key_ref(key: & K) -> bool

Returns true if the map contains a value for the specified

Method get

fn get(key: K) -> V

Get the value for the specified key. Fails if the key does not exist in the map.

Method find

fn find(key: K) -> Option<V>

Get the value for the specified key. If the key does not exist in the map then returns none.

Method remove

fn remove(key: K) -> bool

Remove and return a value from the map. Returns true if the key was present in the map, otherwise false.

Method clear

fn clear()

Clear the map, removing all key/value pairs.

Method each

fn each(fn&(key: K, value: V) -> bool)

Iterate over all the key/value pairs in the map by value

Method each_key

fn each_key(fn&(key: K) -> bool)

Iterate over all the keys in the map by value

Method each_value

fn each_value(fn&(value: V) -> bool)

Iterate over all the values in the map by value

Method each_ref

fn each_ref(fn&(key: & K, value: & V) -> bool)

Iterate over all the key/value pairs in the map by reference

Method each_key_ref

fn each_key_ref(fn&(key: & K) -> bool)

Iterate over all the keys in the map by reference

Method each_value_ref

fn each_value_ref(fn&(value: & V) -> bool)

Iterate over all the values in the map by reference

Implementation of Map<K, V> for @Mut<LinearMap<K, V>>

Method size

fn size() -> uint

Method insert

fn insert(key: K, value: V) -> bool

Method contains_key

fn contains_key(key: K) -> bool

Method contains_key_ref

fn contains_key_ref(key: & K) -> bool

Method get

fn get(key: K) -> V

Method find

fn find(key: K) -> Option<V>

Method remove

fn remove(key: K) -> bool

Method clear

fn clear()

Method each

fn each(op: fn&(key: K, value: V) -> bool)

Method each_key

fn each_key(op: fn&(key: K) -> bool)

Method each_value

fn each_value(op: fn&(value: V) -> bool)

Method each_ref

fn each_ref(op: fn&(key: & K, value: & V) -> bool)

Method each_key_ref

fn each_key_ref(op: fn&(key: & K) -> bool)

Method each_value_ref

fn each_value_ref(op: fn&(value: & V) -> bool)

Function HashMap

fn HashMap<K: Eq IterBytes Hash Const, V: Copy>() -> HashMap<K, V>

Function hash_from_vec

fn hash_from_vec<K: Eq IterBytes Hash Const Copy, V: Copy>(items: & [(K, V)])
   -> HashMap<K, V>

Construct a hashmap from a vector

Function set_add

fn set_add<K: Eq IterBytes Hash Const Copy>(set: Set<K>, key: K) -> bool

Convenience function for adding keys to a hashmap with nil type keys

Function vec_from_set

fn vec_from_set<T: Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T]

Convert a set into a vector.