Builder

Trait Builder 

Source
pub trait Builder<H: CHasher>: Send + Sync {
    // Required methods
    fn add(
        &mut self,
        hasher: &mut impl Hasher<H>,
        element: &[u8],
    ) -> impl Future<Output = Result<u64, Error>>;
    fn root(&self, hasher: &mut impl Hasher<H>) -> H::Digest;
}
Expand description

A trait for building an MMR and computing the root.

Required Methods§

Source

fn add( &mut self, hasher: &mut impl Hasher<H>, element: &[u8], ) -> impl Future<Output = Result<u64, Error>>

Add element to the MMR and return its position within it. The element can be an arbitrary byte slice, and need not be converted to a digest first.

Source

fn root(&self, hasher: &mut impl Hasher<H>) -> H::Digest

Return the root hash of the MMR.

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§

Source§

impl<E: RStorage + Clock + Metrics, H: CHasher> Builder<H> for commonware_storage::mmr::journaled::Mmr<E, H>

Source§

impl<H: CHasher> Builder<H> for commonware_storage::mmr::mem::Mmr<H>