pub struct CompactableHeaplessTree<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB = Proof<ARITY, HEIGHT, H, MAX_INPUT_LEN>>{ /* private fields */ }Expand description
Tree that can be compacted after leaf removal and reduced to a smaller tree
Implementations§
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> CompactableHeaplessTree<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(prefixed: &[Prefixed<ARITY, H>]) -> Result<Self, Error>
pub fn try_from_leaves(prefixed: &[Prefixed<ARITY, H>]) -> Result<Self, Error>
creates a tree from hashed leaves (of another tree)
Sourcepub fn try_reduce(
self,
) -> Result<CompactableHeaplessTree<ARITY, { _ }, H, MAX_INPUT_LEN, PB>, Self>
pub fn try_reduce( self, ) -> Result<CompactableHeaplessTree<ARITY, { _ }, H, MAX_INPUT_LEN, PB>, Self>
tries to compact this tree to a size of a tree with height-1 and create an instance of the new tree Note: takes ownership, but as it implements Copy trait may need explicit dropping to prevent being any longer available
Trait Implementations§
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> CanRemove for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> CanRemove for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Clone for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Clone for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Debug for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Debug for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Source§impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Default for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Default for CompactableHeaplessTree<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 CompactableHeaplessTree<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 CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
Source§fn generate_proof(&self, index: usize) -> PB
fn generate_proof(&self, index: usize) -> PB
generate a proof for a leaf at index
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
Auto Trait Implementations§
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Freeze for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> RefUnwindSafe for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Send for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Sync for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> Unpin for CompactableHeaplessTree<ARITY, HEIGHT, H, MAX_INPUT_LEN, PB>
impl<const ARITY: usize, const HEIGHT: usize, H, const MAX_INPUT_LEN: usize, PB> UnwindSafe for CompactableHeaplessTree<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