Trait linera_views::views::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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Hasher for Sha3_256

Implementors§