A simple map based on a vector for small integer keys. Space requirements are O(highest integer key).

Type smallintmap

type smallintmap<T: copy> = @{v: dvec<option<T>>,}

Implementation map of map::map<uint, V> for smallintmap<V>

Implements the map::map interface for smallintmap

Method size

fn size() -> uint

Method insert

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

Method remove

fn remove(&&key: uint) -> option<V>

Method clear

fn clear()

Method contains_key

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

Method get

fn get(&&key: uint) -> V

Method []

fn [](&&key: uint) -> V

Method find

fn find(&&key: uint) -> option<V>

Method rehash

fn rehash()

Method each

fn each(it: fn(&&uint, V) -> bool)

Method each_key

fn each_key(it: fn(&&uint) -> bool)

Method each_value

fn each_value(it: fn(V) -> bool)

Function as_map

fn as_map<V: copy>(s: smallintmap<V>) -> map::map<uint, V>

Cast the given smallintmap to a map::map

Function contains_key

fn contains_key<T: copy>(self: smallintmap<T>, key: uint) -> bool

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

Function find

fn find<T: copy>(self: smallintmap<T>, key: uint) -> option<T>

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

Function get

fn get<T: copy>(self: smallintmap<T>, key: uint) -> T

Get the value for the specified key

Failure

If the key does not exist in the map

Function insert

fn insert<T: copy>(self: smallintmap<T>, key: uint, val: T)

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

Function mk

fn mk<T: copy>() -> smallintmap<T>

Create a smallintmap