Skip to main content

Hashed

Trait Hashed 

Source
pub trait Hashed {
    // Required method
    fn hash(&self) -> &Hash256;
}
Expand description

The Hashed trait indicates, that the hash over some data was already calculated and saved.

Datatypes that internally save their hash can implement this, so that the hash does not need to be re-calculated everytime we ask for it. Note: All types that implement Hashed automatically implement Hashable, since they can always return a copy of the internally saved hash.

Required Methods§

Source

fn hash(&self) -> &Hash256

Returns a reference to the pre-calculated hash of the datatype.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§