pub trait Hasher{
type Hash: Copy + AsRef<[u8]> + BorshSerialize + BorshDeserialize + Debug + Default + Eq + Hash + PartialOrd + PartialEq + Serialize + for<'a> Deserialize<'a>;
// Required method
fn hashv(data: &[impl AsRef<[u8]>]) -> Self::Hash;
}
Expand description
We provide Hasher
as a small hashing abstraction.
This trait allows us to use a more abstract idea of hashing than the Digest
trait from the
digest
create provides. In particular, if we want to use none cryptographic hashes or hashes
that fit the mathematical definition of a hash, we can do this with this far more general
abstraction.
Required Associated Types§
type Hash: Copy + AsRef<[u8]> + BorshSerialize + BorshDeserialize + Debug + Default + Eq + Hash + PartialOrd + PartialEq + Serialize + for<'a> Deserialize<'a>
Required Methods§
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.