A simple map based on a vector for small integer keys. Space requirements are O(highest integer key).
SmallIntMap_
SmallIntMap
of map::Map<uint, V> for SmallIntMap<V>
- Implements the map::map interface for smallintmapof ops::Index<uint, V> for SmallIntMap<V>
as_map
- Cast the given smallintmap to a map::mapcontains_key
- Returns true if the map contains a value for the specified keyfind
- Get the value for the specified keyget
- Get the value for the specified keyinsert
- Add a value to the mapmk
- Create a smallintmapSmallIntMap_
type SmallIntMap_<T: Copy> = {v: DVec<Option<T>>,}
SmallIntMap
SmallIntMap_(@SmallIntMap_<T>)
map::Map<uint, V>
for SmallIntMap<V>
Implements the map::map interface for smallintmap
size
fn size() -> uint
insert
fn insert(key: uint, value: V) -> bool
remove
fn remove(key: uint) -> bool
clear
fn clear()
contains_key
fn contains_key(key: uint) -> bool
contains_key_ref
fn contains_key_ref(key: & uint) -> bool
get
fn get(key: uint) -> V
find
fn find(key: uint) -> Option<V>
rehash
fn rehash()
each
fn each(it: fn&(key: uint, value: V) -> bool)
each_key
fn each_key(it: fn&(key: uint) -> bool)
each_value
fn each_value(it: fn&(value: V) -> bool)
each_ref
fn each_ref(it: fn&(key: & uint, value: & V) -> bool)
each_key_ref
fn each_key_ref(blk: fn&(key: & uint) -> bool)
each_value_ref
fn each_value_ref(blk: fn&(value: & V) -> bool)
ops::Index<uint, V>
for SmallIntMap<V>
index
fn index(key: uint) -> V
as_map
fn as_map<V: Copy>(s: SmallIntMap<V>) -> map::Map<uint, V>
Cast the given smallintmap to a map::map
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
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
get
fn get<T: Copy>(self: SmallIntMap<T>, key: uint) -> T
Get the value for the specified key
If the key does not exist in the map
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.
mk
fn mk<T: Copy>() -> SmallIntMap<T>
Create a smallintmap