[][src]Struct poseidon252::tree::PoseidonTree

pub struct PoseidonTree<T, H> where
    T: Content<H>,
    &'a T: Into<StorageScalar>,
    H: ByteHash, 
{ /* fields omitted */ }

A zk-friendly datastructure to store elements

Implementations

impl<T, H> PoseidonTree<T, H> where
    T: Content<H>,
    &'a T: Into<StorageScalar>,
    H: ByteHash, 
[src]

pub fn new(depth: usize) -> Self[src]

Constructs a new empty PoseidonTree

pub fn root(&self) -> Result<BlsScalar>[src]

Returns the scalar root-hash of the poseidon tree

This includes padding the value to the correct branch length equivalent

pub fn poseidon_branch(&self, idx: u64) -> Result<Option<PoseidonBranch>>[src]

Returns a poseidon branch pointing at the specific index

This includes padding the value to the correct branch length equivalent

pub fn push(&mut self, t: T) -> Result<u64>[src]

Push a new item onto the tree

pub fn get(
    &self,
    idx: u64
) -> Result<Option<Branch<NStack<T, PoseidonAnnotation, H>, H>>>
[src]

Get a branch reference to the element at index idx, if any

pub fn get_mut(
    &mut self,
    idx: u64
) -> Result<Option<BranchMut<NStack<T, PoseidonAnnotation, H>, H>>>
[src]

Get a mutable branch reference to the element at index idx, if any

Trait Implementations

impl<T, H> Clone for PoseidonTree<T, H> where
    T: Content<H>,
    &'a T: Into<StorageScalar>,
    H: ByteHash, 
[src]

impl<T, H> Content<H> for PoseidonTree<T, H> where
    T: Content<H>,
    &'a T: Into<StorageScalar>,
    H: ByteHash, 
[src]

Auto Trait Implementations

impl<T, H> !RefUnwindSafe for PoseidonTree<T, H>

impl<T, H> !Send for PoseidonTree<T, H>

impl<T, H> !Sync for PoseidonTree<T, H>

impl<T, H> Unpin for PoseidonTree<T, H> where
    T: Unpin,
    <H as ByteHash>::Digest: Unpin

impl<T, H> !UnwindSafe for PoseidonTree<T, H>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,