NodeHasher

Trait NodeHasher 

Source
pub trait NodeHasher {
    type HashOutput;

    // Required method
    fn hash_children<'a, L>(
        &'a self,
        iter: Children<'a, Self::HashOutput, L>,
    ) -> Self::HashOutput;
}
Expand description

An algorithm to compute a hash of a sequence of child nodes.

The abstraction provided by NodeHasher is agnostic to the implementation of the hash function, and allows different ways of calculating the hash of child nodes for their parent node.

Required Associated Types§

Source

type HashOutput

The output of the hash function.

Required Methods§

Source

fn hash_children<'a, L>( &'a self, iter: Children<'a, Self::HashOutput, L>, ) -> Self::HashOutput

Hash a sequence of child nodes to produce the parent hash value.

This method is used to calculate hash values of the non-leaf nodes in the Merkle tree under construction. The iterator retrieves at least one node. When it’s exactly one, this is likely to be the special case described in the documentation to Builder::chain_lone_child() method.

The type parameter represents arbitrary list node data and should be ignored for all purposes.

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.

Implementors§