Module hash
Generic hashing support.
This module provides a generic way to compute the hash of a value.
Hashes are most commonly used with HashMap and HashSet.
The simplest way to make a type hashable is to use #[derive(Hash)]:
Examples
use ;
let person1 = Person ;
let person2 = Person ;
assert!;
If you need more control over how a value is hashed, you need to implement
the Hash trait:
use ;
let person1 = Person ;
let person2 = Person ;
assert_eq!;
Structs
-
BuildHasherDefault
Used to create a default
BuildHasherinstance for types that implementHasherandDefault.[
HashMap]: [method.default]: BuildHasherDefault::default [HashMap]: ../../std/collections/struct.HashMap.html [HashSet]: ../../std/collections/struct.HashSet.html [zero-sized]: https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts
Traits
-
BuildHasher
A trait for creating instances of
Hasher. - Hash A hashable type.
- Hasher A trait for hashing an arbitrary stream of bytes.