pub struct StaticTree<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB = Proof<ARITY, HEIGHT, H, MAX_INPUT_LEN>>{ /* private fields */ }Expand description
Basic statically-allocated Merkle Tree
Implementations§
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Sourcepub fn try_from<T: AsRef<[u8]> + Deref<Target = [u8]>>(
input: &[T],
) -> Result<Self, Error>
pub fn try_from<T: AsRef<[u8]> + Deref<Target = [u8]>>( input: &[T], ) -> Result<Self, Error>
creates a tree from an input if possible
Sourcepub fn from<T: AsRef<[u8]> + Deref<Target = [u8]>>(input: &[T]) -> Self
pub fn from<T: AsRef<[u8]> + Deref<Target = [u8]>>(input: &[T]) -> Self
creates a tree from an input if possible
Sourcepub fn try_from_leaves(leaves: &[Prefixed<ARITY, H>]) -> Result<Self, Error>
pub fn try_from_leaves(leaves: &[Prefixed<ARITY, H>]) -> Result<Self, Error>
creates a tree from hashed leaves (of another tree)
Trait Implementations§
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Clone for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Clone for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Debug for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Debug for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Default for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Default for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> PartialEq for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> PartialEq for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> StaticTreeTrait<ARITY, H, PB> for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> StaticTreeTrait<ARITY, H, PB> for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Source§fn generate_proof(&self, index: usize) -> PB
fn generate_proof(&self, index: usize) -> PB
generate proof at given index on base layer
Source§fn replace(&mut self, index: usize, input: &[u8])
fn replace(&mut self, index: usize, input: &[u8])
replace an element at index with input panics if index is out of leaf layer bound
Source§fn replace_leaf(&mut self, index: usize, leaf: H::Output)
fn replace_leaf(&mut self, index: usize, leaf: H::Output)
replace a hashed leaf at index with a new hashed value
Source§fn base_layer_size(&self) -> usize
fn base_layer_size(&self) -> usize
a size (not necessarily a number of currently present leaves) of the leaf layer
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Copy for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Auto Trait Implementations§
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Freeze for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> RefUnwindSafe for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Send for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Sync for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Unpin for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> UnwindSafe for StaticTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more