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> ⓘ
pub fn walk<W>(&self, walker: W) -> Walk<'_, T, W, H, A> ⓘ
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§
impl<T: Eq, const H: usize, const A: usize> Eq 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> !Freeze for Tree<T, H, A>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)