Struct dusk_merkle::Tree
source · pub struct Tree<T, const H: usize, const A: usize> { /* private fields */ }
Expand description
A sparse Merkle tree.
Implementations§
source§impl<T, const H: usize, const A: usize> Tree<T, H, A>where
T: Aggregate<A>,
impl<T, const H: usize, const A: usize> Tree<T, H, A>where T: Aggregate<A>,
sourcepub fn remove(&mut self, position: u64) -> Option<T>
pub fn remove(&mut self, position: u64) -> Option<T>
Remove and return the item at the given position
in the tree if it
exists.
sourcepub fn opening(&self, position: u64) -> Option<Opening<T, H, A>>where
T: Clone,
pub fn opening(&self, position: u64) -> Option<Opening<T, H, A>>where T: Clone,
Returns the Opening
for the given position
if it exists.
sourcepub fn walk<W>(&self, walker: W) -> Walk<'_, T, W, H, A> ⓘwhere
W: Fn(&T) -> bool,
pub fn walk<W>(&self, walker: W) -> Walk<'_, T, W, H, A> ⓘwhere W: Fn(&T) -> bool,
Returns a Walk
through the tree, proceeding according to the
walker
function.
A walk starts from the root of the tree, and “drills down” according to
the output of the walker function. The function should return true
or
false
, indicating whether the iterator should continue along the
tree’s path.
sourcepub fn smallest_subtree(&self) -> (Ref<'_, T>, usize)
pub fn smallest_subtree(&self) -> (Ref<'_, T>, usize)
Returns the root of the smallest sub-tree that holds all the leaves.
Trait Implementations§
source§impl<T: PartialEq, const H: usize, const A: usize> PartialEq for Tree<T, H, A>
impl<T: PartialEq, const H: usize, const A: usize> PartialEq for Tree<T, H, A>
impl<T: Eq, const H: usize, const A: usize> Eq for Tree<T, H, A>
impl<T, const H: usize, const A: usize> StructuralEq for Tree<T, H, A>
impl<T, const H: usize, const A: usize> StructuralPartialEq for Tree<T, H, A>
Auto Trait Implementations§
impl<T, const H: usize, const A: usize> !RefUnwindSafe for Tree<T, H, A>
impl<T, const H: usize, const A: usize> Send for Tree<T, H, A>where T: Send,
impl<T, const H: usize, const A: usize> !Sync for Tree<T, H, A>
impl<T, const H: usize, const A: usize> Unpin for Tree<T, H, A>where T: Unpin,
impl<T, const H: usize, const A: usize> UnwindSafe for Tree<T, H, A>where T: UnwindSafe,
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