pub trait MerkleTree {
    type Item;
    type Hash;

    fn height(&self) -> u32;
    fn count(&self) -> usize;
    fn root(&mut self) -> Option<Self::Hash>;
    fn add_batch(&mut self, items: impl IntoIterator<Item = Self::Item>);

    fn add(&mut self, item: Self::Item) { ... }
}
Expand description

Trait for implementing binary merkle tree

Required Associated Types

Type of the leaf data

Type of the hash values

Required Methods

Height of the tree, leaf nodes that store data are counted

Number of leafs

Root hash, lazy-evaluated

Adds a batch of leaves in the give order

Provided Methods

Adds a new leaf

Implementors