linera_views::views

Trait Hasher

Source
pub trait Hasher:
    Default
    + Write
    + Send
    + Sync
    + 'static {
    type Output: Debug + Clone + Eq + AsRef<[u8]> + 'static;

    // Required method
    fn finalize(self) -> Self::Output;

    // Provided methods
    fn update_with_bcs_bytes(
        &mut self,
        value: &impl Serialize,
    ) -> Result<(), ViewError> { ... }
    fn update_with_bytes(&mut self, value: &[u8]) -> Result<(), ViewError> { ... }
}
Expand description

The requirement for the hasher type in HashableView.

Required Associated Types§

Source

type Output: Debug + Clone + Eq + AsRef<[u8]> + 'static

The output type.

Required Methods§

Source

fn finalize(self) -> Self::Output

Finishes the hashing process and returns its output.

Provided Methods§

Source

fn update_with_bcs_bytes( &mut self, value: &impl Serialize, ) -> Result<(), ViewError>

Serializes a value with BCS and includes it in the hash.

Source

fn update_with_bytes(&mut self, value: &[u8]) -> Result<(), ViewError>

Includes bytes in the hash.

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 Hasher for Sha3_256

Implementors§