# 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` type parameter is an abstract hash state that is used by the `Hash` to compute the hash.

If you are also implementing `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` and `HashSet` both rely on this behavior.

This trait can be used with `#[derive]`.

## 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` 1.3.0

Feeds a slice of this type into the state provided.

## Implementors

- `impl<T: Hash + Zeroable> Hash for NonZero<T>`
- `impl<Ret> Hash for fn() -> Ret`
- `impl<Ret> Hash for extern "C" fn() -> Ret`
- `impl<Ret> Hash for unsafe fn() -> Ret`
- `impl<Ret> Hash for unsafe extern "C" fn() -> Ret`
- `impl<Ret, A> Hash for fn(A) -> Ret`
- `impl<Ret, A> Hash for extern "C" fn(A) -> Ret`
- `impl<Ret, A> Hash for unsafe fn(A) -> Ret`
- `impl<Ret, A> Hash for unsafe extern "C" fn(A) -> Ret`
- `impl<Ret, A, B> Hash for fn(A, B) -> Ret`
- `impl<Ret, A, B> Hash for extern "C" fn(A, B) -> Ret`
- `impl<Ret, A, B> Hash for unsafe fn(A, B) -> Ret`
- `impl<Ret, A, B> Hash for unsafe extern "C" fn(A, B) -> Ret`
- `impl<Ret, A, B, C> Hash for fn(A, B, C) -> Ret`
- `impl<Ret, A, B, C> Hash for extern "C" fn(A, B, C) -> Ret`
- `impl<Ret, A, B, C> Hash for unsafe fn(A, B, C) -> Ret`
- `impl<Ret, A, B, C> Hash for unsafe extern "C" fn(A, B, C) -> Ret`
- `impl<Ret, A, B, C, D> Hash for fn(A, B, C, D) -> Ret`
- `impl<Ret, A, B, C, D> Hash for extern "C" fn(A, B, C, D) -> Ret`
- `impl<Ret, A, B, C, D> Hash for unsafe fn(A, B, C, D) -> Ret`
- `impl<Ret, A, B, C, D> Hash for unsafe extern "C" fn(A, B, C, D) -> Ret`
- `impl<Ret, A, B, C, D, E> Hash for fn(A, B, C, D, E) -> Ret`
- `impl<Ret, A, B, C, D, E> Hash for extern "C" fn(A, B, C, D, E) -> Ret`
- `impl<Ret, A, B, C, D, E> Hash for unsafe fn(A, B, C, D, E) -> Ret`
- `impl<Ret, A, B, C, D, E> Hash for unsafe extern "C" fn(A, B, C, D, E) -> Ret`
- `impl<Ret, A, B, C, D, E, F> Hash for fn(A, B, C, D, E, F) -> Ret`
- `impl<Ret, A, B, C, D, E, F> Hash for extern "C" fn(A, B, C, D, E, F) -> Ret`
- `impl<Ret, A, B, C, D, E, F> Hash for unsafe fn(A, B, C, D, E, F) -> Ret`
- `impl<Ret, A, B, C, D, E, F> Hash for unsafe extern "C" fn(A, B, C, D, E, F) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G> Hash for fn(A, B, C, D, E, F, G) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G> Hash for extern "C" fn(A, B, C, D, E, F, G) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G> Hash for unsafe fn(A, B, C, D, E, F, G) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G> Hash for unsafe extern "C" fn(A, B, C, D, E, F, G) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H> Hash for fn(A, B, C, D, E, F, G, H) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H> Hash for extern "C" fn(A, B, C, D, E, F, G, H) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H> Hash for unsafe fn(A, B, C, D, E, F, G, H) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H> Hash for unsafe extern "C" fn(A, B, C, D, E, F, G, H) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I> Hash for fn(A, B, C, D, E, F, G, H, I) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I> Hash for extern "C" fn(A, B, C, D, E, F, G, H, I) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I> Hash for unsafe fn(A, B, C, D, E, F, G, H, I) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I> Hash for unsafe extern "C" fn(A, B, C, D, E, F, G, H, I) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J> Hash for fn(A, B, C, D, E, F, G, H, I, J) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J> Hash for extern "C" fn(A, B, C, D, E, F, G, H, I, J) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J> Hash for unsafe fn(A, B, C, D, E, F, G, H, I, J) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J> Hash for unsafe extern "C" fn(A, B, C, D, E, F, G, H, I, J) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J, K> Hash for fn(A, B, C, D, E, F, G, H, I, J, K) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J, K> Hash for extern "C" fn(A, B, C, D, E, F, G, H, I, J, K) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J, K> Hash for unsafe fn(A, B, C, D, E, F, G, H, I, J, K) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J, K> Hash for unsafe extern "C" fn(A, B, C, D, E, F, G, H, I, J, K) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J, K, L> Hash for fn(A, B, C, D, E, F, G, H, I, J, K, L) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J, K, L> Hash for extern "C" fn(A, B, C, D, E, F, G, H, I, J, K, L) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J, K, L> Hash for unsafe fn(A, B, C, D, E, F, G, H, I, J, K, L) -> Ret`
- `impl<Ret, A, B, C, D, E, F, G, H, I, J, K, L> Hash for unsafe extern "C" fn(A, B, C, D, E, F, G, H, I, J, K, L) -> Ret`
- `impl<T: ?Sized> Hash for PhantomData<T>`
- `impl Hash for TypeId`
- `impl<T: Hash> Hash for [T; 0]`
- `impl<T: Hash> Hash for [T; 1]`
- `impl<T: Hash> Hash for [T; 2]`
- `impl<T: Hash> Hash for [T; 3]`
- `impl<T: Hash> Hash for [T; 4]`
- `impl<T: Hash> Hash for [T; 5]`
- `impl<T: Hash> Hash for [T; 6]`
- `impl<T: Hash> Hash for [T; 7]`
- `impl<T: Hash> Hash for [T; 8]`
- `impl<T: Hash> Hash for [T; 9]`
- `impl<T: Hash> Hash for [T; 10]`
- `impl<T: Hash> Hash for [T; 11]`
- `impl<T: Hash> Hash for [T; 12]`
- `impl<T: Hash> Hash for [T; 13]`
- `impl<T: Hash> Hash for [T; 14]`
- `impl<T: Hash> Hash for [T; 15]`
- `impl<T: Hash> Hash for [T; 16]`
- `impl<T: Hash> Hash for [T; 17]`
- `impl<T: Hash> Hash for [T; 18]`
- `impl<T: Hash> Hash for [T; 19]`
- `impl<T: Hash> Hash for [T; 20]`
- `impl<T: Hash> Hash for [T; 21]`
- `impl<T: Hash> Hash for [T; 22]`
- `impl<T: Hash> Hash for [T; 23]`
- `impl<T: Hash> Hash for [T; 24]`
- `impl<T: Hash> Hash for [T; 25]`
- `impl<T: Hash> Hash for [T; 26]`
- `impl<T: Hash> Hash for [T; 27]`
- `impl<T: Hash> Hash for [T; 28]`
- `impl<T: Hash> Hash for [T; 29]`
- `impl<T: Hash> Hash for [T; 30]`
- `impl<T: Hash> Hash for [T; 31]`
- `impl<T: Hash> Hash for [T; 32]`
- `impl<T: Hash> Hash for Option<T>`
- `impl<T: Hash, E: Hash> Hash for Result<T, E>`
- `impl Hash for u8`
- `impl Hash for u16`
- `impl Hash for u32`
- `impl Hash for u64`
- `impl Hash for usize`
- `impl Hash for i8`
- `impl Hash for i16`
- `impl Hash for i32`
- `impl Hash for i64`
- `impl Hash for isize`
- `impl Hash for bool`
- `impl Hash for char`
- `impl Hash for str`
- `impl Hash for ()`
- `impl<A: Hash> Hash for (A,)`
- `impl<A: Hash, B: Hash> Hash for (A, B)`
- `impl<A: Hash, B: Hash, C: Hash> Hash for (A, B, C)`
- `impl<A: Hash, B: Hash, C: Hash, D: Hash> Hash for (A, B, C, D)`
- `impl<A: Hash, B: Hash, C: Hash, D: Hash, E: Hash> Hash for (A, B, C, D, E)`
- `impl<A: Hash, B: Hash, C: Hash, D: Hash, E: Hash, F: Hash> Hash for (A, B, C, D, E, F)`
- `impl<A: Hash, B: Hash, C: Hash, D: Hash, E: Hash, F: Hash, G: Hash> Hash for (A, B, C, D, E, F, G)`
- `impl<A: Hash, B: Hash, C: Hash, D: Hash, E: Hash, F: Hash, G: Hash, H: Hash> Hash for (A, B, C, D, E, F, G, H)`
- `impl<A: Hash, B: Hash, C: Hash, D: Hash, E: Hash, F: Hash, G: Hash, H: Hash, I: Hash> Hash for (A, B, C, D, E, F, G, H, I)`
- `impl<A: Hash, B: Hash, C: Hash, D: Hash, E: Hash, F: Hash, G: Hash, H: Hash, I: Hash, J: Hash> Hash for (A, B, C, D, E, F, G, H, I, J)`
- `impl<A: Hash, B: Hash, C: Hash, D: Hash, E: Hash, F: Hash, G: Hash, H: Hash, I: Hash, J: Hash, K: Hash> Hash for (A, B, C, D, E, F, G, H, I, J, K)`
- `impl<A: Hash, B: Hash, C: Hash, D: Hash, E: Hash, F: Hash, G: Hash, H: Hash, I: Hash, J: Hash, K: Hash, L: Hash> Hash for (A, B, C, D, E, F, G, H, I, J, K, L)`
- `impl<T: Hash> Hash for [T]`
- `impl<'a, T: ?Sized + Hash> Hash for &'a T`
- `impl<'a, T: ?Sized + Hash> Hash for &'a mut T`
- `impl<T> Hash for *const T`
- `impl<T> Hash for *mut T`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)