Trait Hashable

Source
pub trait Hashable: AsRef<[u8]> {
    // Provided methods
    fn hash<H>(&self) -> H::Digest
       where H: Hash { ... }
    fn hash_with<H>(&self, hash: &mut H)
       where H: Hash { ... }
}
Expand description

A trait for simple bytes-like objects.

Provided Methods§

Source

fn hash<H>(&self) -> H::Digest
where H: Hash,

Computes the hash digest.

Source

fn hash_with<H>(&self, hash: &mut H)
where H: Hash,

Updates the given hash instance with the bytes from this object.

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 Hashable for &str

Source§

impl Hashable for &[u8]

Source§

impl Hashable for String

Source§

impl Hashable for Vec<u8>

Source§

impl<T> Hashable for &T
where T: Hashable,

Source§

impl<T> Hashable for &mut T
where T: Hashable,

Source§

impl<const LENGTH: usize> Hashable for [u8; LENGTH]

Implementors§