Trait trie_db::Hasher

source ·
pub trait Hasher: Sync + Send {
    type Out: AsRef<[u8]> + AsMut<[u8]> + Default + MaybeDebug + Ord + PartialEq + Eq + Hash + Send + Sync + Clone + Copy;
    type StdHasher: Sync + Send + Default + Hasher;

    const LENGTH: usize;

    // Required method
    fn hash(x: &[u8]) -> Self::Out;
}
Expand description

Trait describing an object that can hash a slice of bytes. Used to abstract other types over the hashing algorithm. Defines a single hash method and an Out associated type with the necessary bounds.

Required Associated Types§

source

type Out: AsRef<[u8]> + AsMut<[u8]> + Default + MaybeDebug + Ord + PartialEq + Eq + Hash + Send + Sync + Clone + Copy

The output type of the Hasher

source

type StdHasher: Sync + Send + Default + Hasher

What to use to build HashMaps with this Hasher.

Required Associated Constants§

source

const LENGTH: usize

The length in bytes of the Hasher output.

Required Methods§

source

fn hash(x: &[u8]) -> Self::Out

Compute the hash of the provided slice of bytes returning the Out type of the Hasher.

Object Safety§

This trait is not object safe.

Implementors§