Open addressing with linear probing.

Struct 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>>],
}

Struct LinearSet

pub struct LinearSet<T> {
    priv map: LinearMap<T, ()>,
}

Implementation of BaseIter<(&'self K, &'self V)> for LinearMap<K, V> where <'self, K: Hash + IterBytes + Eq, V>

Method each

fn each(&self, blk: &fn(&(&'self K, &'self V)) -> bool)

Visit all key-value pairs

Method size_hint

fn size_hint(&self) -> Option<uint>

Implementation of Container for LinearMap<K, V> where <K: Hash + IterBytes + Eq, V>

Method len

fn len(&const self) -> uint

Return the number of elements in the map

Method is_empty

fn is_empty(&const self) -> bool

Return true if the map contains no elements

Implementation of Mutable for LinearMap<K, V> where <K: Hash + IterBytes + Eq, V>

Method clear

fn clear(&mut self)

Clear the map, removing all key-value pairs.

Implementation of Map<K, V> for LinearMap<K, V> where <'self, K: Hash + IterBytes + Eq, V>

Method contains_key

fn contains_key(&self, k: &K) -> bool

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

Method each_key

fn each_key(&self, blk: &fn(k: &K) -> bool)

Visit all keys

Method each_value

fn each_value(&self, blk: &fn(v: &V) -> bool)

Visit all values

Method mutate_values

fn mutate_values(&mut self, blk: &fn(&'self K, &'self mut V) -> bool)

Iterate over the map and mutate the contained values

Method find

fn find(&self, k: &K) -> Option<&'self V>

Return a reference to the value corresponding to the key

Method find_mut

fn find_mut(&mut self, k: &K) -> Option<&'self mut V>

Return a mutable reference to the value corresponding to the key

Method 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.

Method 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.

Implementation for LinearMap<K, V> where <K: Hash + IterBytes + Eq, V>

Method new

fn new() -> LinearMap<K, V>

Create an empty LinearMap

Method 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.

Method reserve_at_least

fn reserve_at_least(&mut self, n: uint)

Reserve space for at least n elements in the hash table.

Method pop

fn pop(&mut self, k: &K) -> Option<V>

Method swap

fn swap(&mut self, k: K, v: V) -> Option<V>

Method 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.

Method 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.

Method consume

fn consume(&mut self, f: &fn(K, V))

Method get

fn get(&self, k: &K) -> &'self V

Method 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

Method 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

Implementation of Eq for LinearMap<K, V> where <K: Hash + IterBytes + Eq, V: Eq>

Method eq

fn eq(&self, other: &LinearMap<K, V>) -> bool

Method ne

fn ne(&self, other: &LinearMap<K, V>) -> bool

Implementation of BaseIter<T> for LinearSet<T> where <T: Hash + IterBytes + Eq>

Method each

fn each(&self, f: &fn(&T) -> bool)

Visit all values in order

Method size_hint

fn size_hint(&self) -> Option<uint>

Implementation of Eq for LinearSet<T> where <T: Hash + IterBytes + Eq>

Method eq

fn eq(&self, other: &LinearSet<T>) -> bool

Method ne

fn ne(&self, other: &LinearSet<T>) -> bool

Implementation of Container for LinearSet<T> where <T: Hash + IterBytes + Eq>

Method len

fn len(&const self) -> uint

Return the number of elements in the set

Method is_empty

fn is_empty(&const self) -> bool

Return true if the set contains no elements

Implementation of Mutable for LinearSet<T> where <T: Hash + IterBytes + Eq>

Method clear

fn clear(&mut self)

Clear the set, removing all values.

Implementation of Set<T> for LinearSet<T> where <T: Hash + IterBytes + Eq>

Method contains

fn contains(&self, value: &T) -> bool

Return true if the set contains a value

Method 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.

Method remove

fn remove(&mut self, value: &T) -> bool

Remove a value from the set. Return true if the value was present in the set.

Method 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.

Method is_subset

fn is_subset(&self, other: &LinearSet<T>) -> bool

Return true if the set is a subset of another

Method is_superset

fn is_superset(&self, other: &LinearSet<T>) -> bool

Return true if the set is a superset of another

Method difference

fn difference(&self, other: &LinearSet<T>, f: &fn(&T) -> bool)

Visit the values representing the difference

Method symmetric_difference

fn symmetric_difference(&self, other: &LinearSet<T>, f: &fn(&T) -> bool)

Visit the values representing the symmetric difference

Method intersection

fn intersection(&self, other: &LinearSet<T>, f: &fn(&T) -> bool)

Visit the values representing the intersection

Method union

fn union(&self, other: &LinearSet<T>, f: &fn(&T) -> bool)

Visit the values representing the union

Implementation for LinearSet<T> where <T: Hash + IterBytes + Eq>

Method new

fn new() -> LinearSet<T>

Create an empty LinearSet

Method with_capacity

fn with_capacity(capacity: uint) -> LinearSet<T>

Create an empty LinearSet with space for at least n elements in the hash table.

Method reserve_at_least

fn reserve_at_least(&mut self, n: uint)

Reserve space for at least n elements in the hash table.

Method consume

fn consume(&mut self, f: &fn(T))

Consumes all of the elements in the set, emptying it out

Function linear_map_with_capacity

fn linear_map_with_capacity<K: Eq + Hash, V>(initial_capacity: uint) ->
 LinearMap<K, V>