Trait BitHash

Source
pub trait BitHash {
    // Required method
    fn bit_hash<H: Hasher>(&self, state: &mut H);
}
Expand description

A hash implementation for types which normally wouldn’t have one, implemented using a hash of the bitwise equivalent types when needed.

If a type is BitHash and BitEq, then it is important that the following property holds:

k1 biteq k2 -> bithash(k1) == bithash(k2)

See the docs on Hash for more information.

Useful for creating caches based on exact values. See the module level docs for more information.

Required Methods§

Source

fn bit_hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher.

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.

Implementations on Foreign Types§

Source§

impl BitHash for f32

Source§

fn bit_hash<H: Hasher>(&self, state: &mut H)

Source§

impl<T: BitHash> BitHash for &T

Source§

fn bit_hash<H: Hasher>(&self, state: &mut H)

Source§

impl<T: BitHash> BitHash for [T]

Source§

fn bit_hash<H: Hasher>(&self, state: &mut H)

Source§

impl<T: BitHash, const N: usize> BitHash for [T; N]

Source§

fn bit_hash<H: Hasher>(&self, state: &mut H)

Implementors§