pub trait HashContext<K> {
// Required methods
fn hash(&self, key: &K) -> u64;
fn eq(&self, a: &K, b: &K) -> bool;
}Expand description
Provides hashing and equality for keys of type K.
Implementors replace the standard Hash + Eq trait combination, allowing
custom hash functions without needing newtype wrappers.
§Contract
- If
eq(a, b)returnstrue, thenhash(a) == hash(b)must also hold. eqmust be an equivalence relation (reflexive, symmetric, transitive).