Trait Accumulator

Source
pub trait Accumulator<'a>
where Self: Sized, Self::Proof: 'a + Sized,
{ type Proof; // Required methods fn prove(&'a self, item: &[u8]) -> Option<Self::Proof>; fn check(&'a self, proof: Self::Proof, item: &[u8]) -> bool; fn from_set(items: impl Iterator<Item = &'a [u8]>) -> Option<Self>; }
Expand description

The Accumulator trait defines the interface for an accumulator.

This trait assumes an accumulator has an associated proof type that can be used to prove membership of a specific item. The choice to return Proof makes this the most generic implementation possible for any accumulator.

Required Associated Types§

Required Methods§

Source

fn prove(&'a self, item: &[u8]) -> Option<Self::Proof>

Prove an item is a member of the accumulator.

Source

fn check(&'a self, proof: Self::Proof, item: &[u8]) -> bool

Verify an item is a member of the accumulator.

Source

fn from_set(items: impl Iterator<Item = &'a [u8]>) -> Option<Self>

Create an accumulator from a set of items.

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<'a> Accumulator<'a> for MulAccumulator<PrimeHasher>

Source§

impl<'a, H: Hasher + 'a> Accumulator<'a> for MerkleTree<H>

Presents an Accumulator friendly interface for MerkleTree.