[−][src]Struct poseidon252::tree::PoseidonTree
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][−]
T: Content<H>,
&'a T: Into<StorageScalar>,
H: ByteHash,
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][−]
&self,
idx: u64
) -> Result<Option<Branch<NStack<T, PoseidonAnnotation, H>, H>>>
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][−]
&mut self,
idx: u64
) -> Result<Option<BranchMut<NStack<T, PoseidonAnnotation, H>, H>>>
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][+]
T: Content<H>,
&'a T: Into<StorageScalar>,
H: ByteHash,
impl<T, H> Content<H> for PoseidonTree<T, H> where
T: Content<H>,
&'a T: Into<StorageScalar>,
H: ByteHash,
[src][+]
T: Content<H>,
&'a T: Into<StorageScalar>,
H: ByteHash,
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,
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][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
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][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[+]
V: MultiLane<T>,