Struct MulAccumulator

Source
pub struct MulAccumulator<H: Hasher> {
    pub accumulator: H::Hash,
    pub items: Vec<H::Hash>,
}
Expand description

A multiplication based Accumulator

This accumulator relies on the quasi-commutative nature of the multiplication operator. It’s here mostly as a an example to gain intuition for how accumulators should function. This implementation relies on the fact that / can be used to “remove” an element but typically an accumulator cannot rely on having a shortcut, and must re-accumulate sans the element being proved to be a member.

Fields§

§accumulator: H::Hash§items: Vec<H::Hash>

Trait Implementations§

Source§

impl<'a> Accumulator<'a> for MulAccumulator<PrimeHasher>

Source§

type Proof = <PrimeHasher as Hasher>::Hash

Source§

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

Prove an item is a member of the accumulator.
Source§

fn check(&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.

Auto Trait Implementations§

§

impl<H> Freeze for MulAccumulator<H>
where <H as Hasher>::Hash: Freeze,

§

impl<H> RefUnwindSafe for MulAccumulator<H>
where <H as Hasher>::Hash: RefUnwindSafe,

§

impl<H> Send for MulAccumulator<H>
where <H as Hasher>::Hash: Send,

§

impl<H> Sync for MulAccumulator<H>
where <H as Hasher>::Hash: Sync,

§

impl<H> Unpin for MulAccumulator<H>
where <H as Hasher>::Hash: Unpin,

§

impl<H> UnwindSafe for MulAccumulator<H>
where <H as Hasher>::Hash: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.