Trait AppendableMerkleTreeScheme

Source
pub trait AppendableMerkleTreeScheme: MerkleTreeScheme<Index = u64> {
    // Required method
    fn push(
        &mut self,
        elem: impl Borrow<Self::Element>,
    ) -> Result<(), MerkleTreeError>;

    // Provided method
    fn extend(
        &mut self,
        elems: impl IntoIterator<Item = impl Borrow<Self::Element>>,
    ) -> Result<(), MerkleTreeError> { ... }
}
Expand description

Merkle tree that allows insertion at back. Abstracted as a commitment for append-only vector.

Required Methods§

Source

fn push( &mut self, elem: impl Borrow<Self::Element>, ) -> Result<(), MerkleTreeError>

Insert a new value at the leftmost available slot

  • elem - element to insert in the tree
  • returns - Ok(()) if successful

Provided Methods§

Source

fn extend( &mut self, elems: impl IntoIterator<Item = impl Borrow<Self::Element>>, ) -> Result<(), MerkleTreeError>

Insert a list of new values at the leftmost available slots

  • elems - elements to insert
  • returns - Ok(()) if successful. If there are too many elements, insertions will be performed until the merkle tree is full, and will return an Err().

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, H, const ARITY: usize, T> AppendableMerkleTreeScheme for MerkleTree<E, H, u64, ARITY, T>
where E: Element, H: DigestAlgorithm<E, u64, T>, T: NodeValue,

Source§

impl<E, H, const ARITY: usize, T> AppendableMerkleTreeScheme for LightWeightMerkleTree<E, H, u64, ARITY, T>
where E: Element, H: DigestAlgorithm<E, u64, T>, T: NodeValue,