Open addressing with linear probing.
LinearMap
LinearSet
of BaseIter<(&'self K, &'self V)> for LinearMap<K, V> where <'self, K: Hash + IterBytes + Eq, V>
of Container for LinearMap<K, V> where <K: Hash + IterBytes + Eq, V>
of Mutable for LinearMap<K, V> where <K: Hash + IterBytes + Eq, V>
of Map<K, V> for LinearMap<K, V> where <'self, K: Hash + IterBytes + Eq, V>
for LinearMap<K, V> where <K: Hash + IterBytes + Eq, V>
of Eq for LinearMap<K, V> where <K: Hash + IterBytes + Eq, V: Eq>
of BaseIter<T> for LinearSet<T> where <T: Hash + IterBytes + Eq>
of Eq for LinearSet<T> where <T: Hash + IterBytes + Eq>
of Container for LinearSet<T> where <T: Hash + IterBytes + Eq>
of Mutable for LinearSet<T> where <T: Hash + IterBytes + Eq>
of Set<T> for LinearSet<T> where <T: Hash + IterBytes + Eq>
for LinearSet<T> where <T: Hash + IterBytes + Eq>
linear_map_with_capacity
LinearMap
pub struct LinearMap<K, V> {
priv k0: u64,
priv k1: u64,
priv resize_at: uint,
priv size: uint,
priv buckets: ~[Option<Bucket<K, V>>],
}
LinearSet
pub struct LinearSet<T> {
priv map: LinearMap<T, ()>,
}
BaseIter<(&'self K, &'self V)>
for LinearMap<K, V>
where <'self, K: Hash + IterBytes + Eq, V>
each
fn each(&self, blk: &fn(&(&'self K, &'self V)) -> bool)
Visit all key-value pairs
size_hint
fn size_hint(&self) -> Option<uint>
Container
for LinearMap<K, V>
where <K: Hash + IterBytes + Eq, V>
len
fn len(&const self) -> uint
Return the number of elements in the map
is_empty
fn is_empty(&const self) -> bool
Return true if the map contains no elements
Mutable
for LinearMap<K, V>
where <K: Hash + IterBytes + Eq, V>
clear
fn clear(&mut self)
Clear the map, removing all key-value pairs.
Map<K, V>
for LinearMap<K, V>
where <'self, K: Hash + IterBytes + Eq, V>
contains_key
fn contains_key(&self, k: &K) -> bool
Return true if the map contains a value for the specified key
each_key
fn each_key(&self, blk: &fn(k: &K) -> bool)
Visit all keys
each_value
fn each_value(&self, blk: &fn(v: &V) -> bool)
Visit all values
mutate_values
fn mutate_values(&mut self, blk: &fn(&'self K, &'self mut V) -> bool)
Iterate over the map and mutate the contained values
find
fn find(&self, k: &K) -> Option<&'self V>
Return a reference to the value corresponding to the key
find_mut
fn find_mut(&mut self, k: &K) -> Option<&'self mut V>
Return a mutable reference to the value corresponding to the key
insert
fn insert(&mut self, k: K, v: 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.
remove
fn remove(&mut self, k: &K) -> bool
Remove a key-value pair from the map. Return true if the key was present in the map, otherwise false.
LinearMap<K, V>
where <K: Hash + IterBytes + Eq, V>
new
fn new() -> LinearMap<K, V>
Create an empty LinearMap
with_capacity
fn with_capacity(capacity: uint) -> LinearMap<K, V>
Create an empty LinearMap with space for at least n
elements in the hash table.
reserve_at_least
fn reserve_at_least(&mut self, n: uint)
Reserve space for at least n
elements in the hash table.
pop
fn pop(&mut self, k: &K) -> Option<V>
swap
fn swap(&mut self, k: K, v: V) -> Option<V>
find_or_insert
fn find_or_insert(&mut self, k: K, v: V) -> &'self V
Return the value corresponding to the key in the map, or insert and return the value if it doesn't exist.
find_or_insert_with
fn find_or_insert_with(&mut self, k: K, f: &fn(&K) -> V) -> &'self V
Return the value corresponding to the key in the map, or create, insert, and return a new value if it doesn't exist.
consume
fn consume(&mut self, f: &fn(K, V))
get
fn get(&self, k: &K) -> &'self V
contains_key_equiv
fn contains_key_equiv<Q: Hash + IterBytes + Equiv<K>>(&self, key: &Q) -> bool
Return true if the map contains a value for the specified key, using equivalence
find_equiv
fn find_equiv<Q: Hash + IterBytes + Equiv<K>>(&self, k: &Q) ->
Option<&'self V>
Return the value corresponding to the key in the map, using equivalence
Eq
for LinearMap<K, V>
where <K: Hash + IterBytes + Eq, V: Eq>
eq
fn eq(&self, other: &LinearMap<K, V>) -> bool
ne
fn ne(&self, other: &LinearMap<K, V>) -> bool
BaseIter<T>
for LinearSet<T>
where <T: Hash + IterBytes + Eq>
each
fn each(&self, f: &fn(&T) -> bool)
Visit all values in order
size_hint
fn size_hint(&self) -> Option<uint>
Eq
for LinearSet<T>
where <T: Hash + IterBytes + Eq>
eq
fn eq(&self, other: &LinearSet<T>) -> bool
ne
fn ne(&self, other: &LinearSet<T>) -> bool
Container
for LinearSet<T>
where <T: Hash + IterBytes + Eq>
len
fn len(&const self) -> uint
Return the number of elements in the set
is_empty
fn is_empty(&const self) -> bool
Return true if the set contains no elements
Mutable
for LinearSet<T>
where <T: Hash + IterBytes + Eq>
clear
fn clear(&mut self)
Clear the set, removing all values.
Set<T>
for LinearSet<T>
where <T: Hash + IterBytes + Eq>
contains
fn contains(&self, value: &T) -> bool
Return true if the set contains a value
insert
fn insert(&mut self, value: T) -> bool
Add a value to the set. Return true if the value was not already present in the set.
remove
fn remove(&mut self, value: &T) -> bool
Remove a value from the set. Return true if the value was present in the set.
is_disjoint
fn is_disjoint(&self, other: &LinearSet<T>) -> bool
Return true if the set has no elements in common with other
. This is equivalent to checking for an empty intersection.
is_subset
fn is_subset(&self, other: &LinearSet<T>) -> bool
Return true if the set is a subset of another
is_superset
fn is_superset(&self, other: &LinearSet<T>) -> bool
Return true if the set is a superset of another
difference
fn difference(&self, other: &LinearSet<T>, f: &fn(&T) -> bool)
Visit the values representing the difference
symmetric_difference
fn symmetric_difference(&self, other: &LinearSet<T>, f: &fn(&T) -> bool)
Visit the values representing the symmetric difference
intersection
fn intersection(&self, other: &LinearSet<T>, f: &fn(&T) -> bool)
Visit the values representing the intersection
union
fn union(&self, other: &LinearSet<T>, f: &fn(&T) -> bool)
Visit the values representing the union
LinearSet<T>
where <T: Hash + IterBytes + Eq>
new
fn new() -> LinearSet<T>
Create an empty LinearSet
with_capacity
fn with_capacity(capacity: uint) -> LinearSet<T>
Create an empty LinearSet with space for at least n
elements in the hash table.
reserve_at_least
fn reserve_at_least(&mut self, n: uint)
Reserve space for at least n
elements in the hash table.
consume
fn consume(&mut self, f: &fn(T))
Consumes all of the elements in the set, emptying it out
linear_map_with_capacity
fn linear_map_with_capacity<K: Eq + Hash, V>(initial_capacity: uint) ->
LinearMap<K, V>