Struct frequency_hashmap::HashMapFrequency [] [src]

pub struct HashMapFrequency<T, N = usize, S = FnvBuildHasher> where
    T: Hash + Eq,
    N: Num,
    S: BuildHasher
{ /* fields omitted */ }

A frequency counter backed by a HashMap.

Methods

impl<T, N, S> HashMapFrequency<T, N, S> where
    T: Eq + Hash,
    N: Num,
    S: BuildHasher + Default
[src]

Creates an empty HashMapFrequency, a frequency counter backed by a HashMap.

Creates an empty HashMapFrequency, a frequency counter backed by a HashMap with the specified capacity.

The hash map will be able to hold at least capacity elements without reallocating. If capacity is 0, the hash map will not allocate. ```

impl<T, N, S> HashMapFrequency<T, N, S> where
    T: Eq + Hash,
    N: Num,
    S: BuildHasher
[src]

Creates an empty HashMapFrequency, a frequency counter backed by a HashMap which will use the given hash builder to hash keys.

The created map has the default initial capacity.

Warning: hash_builder is normally randomly generated, and is designed to allow HashMaps to be resistant to attacks that cause many collisions and very poor performance. Setting it manually using this function can expose a DoS attack vector. ```

Creates an empty HashMapFrequency, a frequency counter backed by a HashMap with the specified capacity, using hasher to hash the keys.

The hash map will be able to hold at least capacity elements without reallocating. If capacity is 0, the hash map will not allocate. Warning: hasher is normally randomly generated, and is designed to allow HashMaps to be resistant to attacks that cause many collisions and very poor performance. Setting it manually using this function can expose a DoS attack vector.

Returns the number of elements that have been counted.

Returns true if the counter contains no elements.

Reserves capacity for at least additional more elements to be inserted in the HashMap backing this frequency counter. The collection may reserve more space to avoid frequent reallocations.

Panics

Panics if the new allocation size overflows usize.

Trait Implementations

impl<'t, T, N, S> Frequency<'t, T> for HashMapFrequency<T, N, S> where
    T: 't + Eq + Hash,
    N: 't + Num + Clone,
    S: 't + BuildHasher
[src]

The type used to record counts.

The type of an iterator over item-count pairs.

The type of an iterator over items.

The type of an iterator over counts.

Returns the count of an item.

Increments the count for an item.

An iterator visiting all key-value pairs. Iterator element type is (&'t T, &'t usize). Read more

An iterator visiting all keys in arbitrary order. Iterator element type is &'t T. Read more

An iterator visiting all counts in arbitrary order. Iterator element type is &'t usize. Read more

impl<T, N, S> Default for HashMapFrequency<T, N, S> where
    T: Eq + Hash,
    N: Num,
    S: BuildHasher + Default
[src]

Creates an empty HashMapFrequency<T, V, S>, a frequency counter backed by a HashMap with the Default value for the hasher.

impl<T, N, S> Extend<T> for HashMapFrequency<T, N, S> where
    T: Eq + Hash,
    N: Num + Clone,
    S: BuildHasher
[src]

Extends a collection with the contents of an iterator. Read more

impl<T, N, S> FromIterator<T> for HashMapFrequency<T, N, S> where
    T: Eq + Hash,
    N: Num + Clone,
    S: BuildHasher + Default
[src]

Creates a value from an iterator. Read more

impl<'t, T, N, S> IntoIterator for &'t HashMapFrequency<T, N, S> where
    T: 't + Eq + Hash,
    N: 't + Num + Clone,
    S: 't + BuildHasher
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<T, N, S> AsRef<HashMap<T, N, S>> for HashMapFrequency<T, N, S> where
    T: Eq + Hash,
    N: Num,
    S: BuildHasher
[src]

Performs the conversion.

impl<T, N, S> AsMut<HashMap<T, N, S>> for HashMapFrequency<T, N, S> where
    T: Eq + Hash,
    N: Num,
    S: BuildHasher
[src]

Performs the conversion.