HashDef

Trait HashDef 

Source
pub trait HashDef: Sized {
    type Hash: Sized;

    const HASHER: fn(&str) -> Self::Hash;

    // Required methods
    fn new(hash: Self::Hash) -> Self;
    fn is_null(&self) -> bool;

    // Provided method
    fn hashed(s: &str) -> Self { ... }
}
Expand description

Trait for hash values types

This trait is implemented by types created with crate::define_hash_type!().

Required Associated Constants§

Source

const HASHER: fn(&str) -> Self::Hash

Hashing method

Required Associated Types§

Source

type Hash: Sized

Type of hash values (integer type)

Required Methods§

Source

fn new(hash: Self::Hash) -> Self

Create a new hash value from an integer

Source

fn is_null(&self) -> bool

Return true if hash is the null hash (0)

Provided Methods§

Source

fn hashed(s: &str) -> Self

Convert a string into a hash by hashing it

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.

Implementors§