LeafHashCollector

Trait LeafHashCollector 

Source
pub trait LeafHashCollector {
    type Output;

    // Required methods
    fn add_leaf_hash(&mut self, hash: Hash);
    fn complete(self, root: Hash) -> Self::Output;
}
Expand description

A trait for collecting the leaf hashes of a merkle tree while constructing a merkle root.

Required Associated Types§

Source

type Output

The output type of MerkleRootBuilder::complete. This allows for complete to return just the merkle root with NoopLeafHashCollector and also return the leaf hashes when a real LeafHashCollector is used.

Required Methods§

Source

fn add_leaf_hash(&mut self, hash: Hash)

This method is called as each leaf hash in the merkle tree is created.

If the merkle tree consists of just a root node then this method will be called for the root node.

Source

fn complete(self, root: Hash) -> Self::Output

Transforms the merkle root into Self::Output.

Implementations on Foreign Types§

Source§

impl LeafHashCollector for Vec<Hash>

Implementors§