Trait core::hash::Hash [] [src]

pub trait Hash {
    fn hash<H: Hasher>(&self, state: &mut H);

    fn hash_slice<H: Hasher>(data: &[Self], state: &mut H) where Self: Sized { ... }
}

A hashable type.

The H`Htype parameter is an abstract hash state that is used by the` type parameter is an abstract hash state that is used by the Hash`Hash` to compute the hash.

If you are also implementing Eq`Eq`, there is an additional property that is important:

k1 == k2 -> hash(k1) == hash(k2)

In other words, if two keys are equal, their hashes should also be equal. HashMap`HashMapand` and HashSet`HashSet` both rely on this behavior.

Required Methods

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the state given, updating the hasher as necessary.

Provided Methods

fn hash_slice<H: Hasher>(data: &[Self], state: &mut H) where Self: Sized

Unstable

: module was recently redesigned

Feeds a slice of this type into the state provided.

Implementors