pub trait NumHash {
// Required method
fn num_hash<H: Hasher>(&self, state: &mut H);
}
Expand description
Consistent hash implementation among different numeric types.
It’s ensured that if a.num_eq(b)
, then a
and b
will result in the same hash. Although the other direction is
not ensured because it’s infeasible, the hash function is still designed to be as sparse as possible.
Required Methods§
Sourcefn num_hash<H: Hasher>(&self, state: &mut H)
fn num_hash<H: Hasher>(&self, state: &mut H)
Consistent Hash::hash on different numeric types.
This function will ensures if a.num_eq(b)
, then a.num_hash()
and b.num_hash()
manipulate the state in the same way.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.