Open addressing with linear probing.
INITIAL_CAPACITY
SearchResult
Bucket
LinearMap
for LinearMap<K, V>
for LinearMap<K, V>
for LinearMap<K, V>
of cmp::Eq for LinearMap<K, V>
LinearMap
linear_map_with_capacity
linear_map_with_capacity_and_keys
resize_at
INITIAL_CAPACITY
uint
SearchResult
FoundEntry(uint)
FoundHole(uint)
TableFull
Bucket
struct Bucket <K: Eq Hash, V>{
hash: uint,
key: K,
value: V,
}
LinearMap
pub struct LinearMap <K: Eq Hash, V>{
k0: u64,
k1: u64,
resize_at: uint,
size: uint,
buckets: ~[Option<Bucket<K, V>>],
}
LinearMap<K, V>
to_bucket
fn to_bucket(h: uint) -> uint
next_bucket
fn next_bucket(idx: uint, len_buckets: uint) -> uint
bucket_sequence
fn bucket_sequence(hash: uint, op: &fn(uint) -> bool) -> uint
bucket_for_key
fn bucket_for_key(buckets: &[Option<Bucket<K, V>>], k: &K) -> SearchResult
bucket_for_key_with_hash
fn bucket_for_key_with_hash(buckets: &[Option<Bucket<K, V>>], hash: uint,
k: &K) -> SearchResult
expand
fn expand()
Expands the capacity of the array and re-inserts each of the existing buckets.
insert_opt_bucket
fn insert_opt_bucket(bucket: Option<Bucket<K, V>>)
insert_internal
fn insert_internal(hash: uint, k: K, v: V) -> bool
Inserts the key value pair into the buckets. Assumes that there will be a bucket. True if there was no previous entry with that key
pop_internal
fn pop_internal(hash: uint, k: &K) -> Option<V>
search
fn search(hash: uint, op: &fn(x: &Option<Bucket<K, V>>) -> bool)
LinearMap<K, V>
insert
fn insert(k: K, v: V) -> bool
remove
fn remove(k: &K) -> bool
pop
fn pop(k: &K) -> Option<V>
swap
fn swap(k: K, v: V) -> Option<V>
consume
fn consume(f: &fn(K, V))
clear
fn clear()
len
fn len() -> uint
is_empty
fn is_empty() -> bool
contains_key
fn contains_key(k: &K) -> bool
find_ref
fn find_ref(k: &K) -> Option<&self /V>
get_ref
fn get_ref(k: &K) -> &self /V
each
fn each(blk: &fn(k: &K, v: &V) -> bool)
each_key
fn each_key(blk: &fn(k: &K) -> bool)
each_value
fn each_value(blk: &fn(v: &V) -> bool)
LinearMap<K, V>
find
fn find(k: &K) -> Option<V>
get
fn get(k: &K) -> V
cmp::Eq
for LinearMap<K, V>
eq
fn eq(other: &LinearMap<K, V>) -> bool
ne
fn ne(other: &LinearMap<K, V>) -> bool
LinearMap
fn LinearMap<K: Eq Hash, V>() -> LinearMap<K, V>
linear_map_with_capacity
fn linear_map_with_capacity<K: Eq Hash, V>(initial_capacity: uint) ->
LinearMap<K, V>
linear_map_with_capacity_and_keys
fn linear_map_with_capacity_and_keys<K: Eq Hash,
V>(k0: u64, k1: u64,
initial_capacity: uint) ->
LinearMap<K, V>
resize_at
fn resize_at(capacity: uint) -> uint