module std::hashsource
Hashing: the Key interface of hash map keys.
Key is a lang item (LANGUAGE_SPEC.md section 6.1a) at the canonical
path std::hash::Key. The compiler satisfies it for every primitive type
through the extensions below; String declares it, and any type may.
Every enum and struct whose parts all satisfy it satisfies it with no
marker too, through hash_parts and same_parts below.
same is the key equality a map uses, and two keys that are the same
must hash alike. Hashes multiply by odd 64-bit constants with the
wrapping *% (section 4.10), folding the high half down first so keys
differing only there spread too.
Keyhash_bitshash_byteshashhashhashhashhashhashhashhashhashhashhashsamesamesamesamesamesamesamesamesamesamesame
interface Keysource
exp interface Key
Required functions
fn hash(self: &) -> u64;fn same(self: &, other: &Self) -> bool;
Implemented by
fn hash_bitssource
exp fn hash_bits(bits: u64) -> u64
Mixes 64 bits so that every bit of the input reaches the low half.
fn hash_bytessource
exp fn hash_bytes(bytes: &[u8]) -> u64
Hashes the bytes eight at a time, the last chunk padded with zeros.
fn hashsource
exp fn hash(self value: &u8) -> u64
fn hashsource
exp fn hash(self value: &u16) -> u64
fn hashsource
exp fn hash(self value: &u32) -> u64
fn hashsource
exp fn hash(self value: &u64) -> u64
fn hashsource
exp fn hash(self value: &i8) -> u64
fn hashsource
exp fn hash(self value: &i16) -> u64
fn hashsource
exp fn hash(self value: &i32) -> u64
fn hashsource
exp fn hash(self value: &i64) -> u64
fn hashsource
exp fn hash(self value: &f32) -> u64
-0.0 is the same key as 0.0; a NaN is the same as nothing, itself included, so it is never found again.
fn hashsource
exp fn hash(self value: &f64) -> u64
fn hashsource
exp fn hash(self value: &bool) -> u64
fn samesource
exp fn same(self value: &u8, other: &u8) -> bool
fn samesource
exp fn same(self value: &u16, other: &u16) -> bool
fn samesource
exp fn same(self value: &u32, other: &u32) -> bool
fn samesource
exp fn same(self value: &u64, other: &u64) -> bool
fn samesource
exp fn same(self value: &i8, other: &i8) -> bool
fn samesource
exp fn same(self value: &i16, other: &i16) -> bool
fn samesource
exp fn same(self value: &i32, other: &i32) -> bool
fn samesource
exp fn same(self value: &i64, other: &i64) -> bool
fn samesource
exp fn same(self value: &f32, other: &f32) -> bool
fn samesource
exp fn same(self value: &f64, other: &f64) -> bool
fn samesource
exp fn same(self value: &bool, other: &bool) -> bool