Struct incrementalmerkletree::frontier::CommitmentTree
source · pub struct CommitmentTree<H, const DEPTH: u8> { /* private fields */ }
Available on crate feature
legacy-api
only.Expand description
A Merkle tree of note commitments.
Implementations§
source§impl<H, const DEPTH: u8> CommitmentTree<H, DEPTH>
impl<H, const DEPTH: u8> CommitmentTree<H, DEPTH>
pub fn from_parts( left: Option<H>, right: Option<H>, parents: Vec<Option<H>>, ) -> Result<Self, ()>
pub fn is_empty(&self) -> bool
pub fn left(&self) -> &Option<H>
pub fn right(&self) -> &Option<H>
pub fn parents(&self) -> &Vec<Option<H>>
pub fn leaf(&self) -> Option<&H>
pub fn ommers_iter(&self) -> Box<dyn Iterator<Item = &H> + '_>
source§impl<H: Hashable + Clone, const DEPTH: u8> CommitmentTree<H, DEPTH>
impl<H: Hashable + Clone, const DEPTH: u8> CommitmentTree<H, DEPTH>
pub fn from_frontier(frontier: &Frontier<H, DEPTH>) -> Self
pub fn to_frontier(&self) -> Frontier<H, DEPTH>
sourcepub fn append(&mut self, node: H) -> Result<(), ()>
pub fn append(&mut self, node: H) -> Result<(), ()>
Adds a leaf node to the tree.
Returns an error if the tree is full.
pub fn root_at_depth(&self, depth: u8, filler: PathFiller<H>) -> H
Trait Implementations§
source§impl<H: Clone, const DEPTH: u8> Clone for CommitmentTree<H, DEPTH>
impl<H: Clone, const DEPTH: u8> Clone for CommitmentTree<H, DEPTH>
source§fn clone(&self) -> CommitmentTree<H, DEPTH>
fn clone(&self) -> CommitmentTree<H, DEPTH>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl<H: Eq, const DEPTH: u8> Eq for CommitmentTree<H, DEPTH>
impl<H, const DEPTH: u8> StructuralPartialEq for CommitmentTree<H, DEPTH>
Auto Trait Implementations§
impl<H, const DEPTH: u8> Freeze for CommitmentTree<H, DEPTH>where
H: Freeze,
impl<H, const DEPTH: u8> RefUnwindSafe for CommitmentTree<H, DEPTH>where
H: RefUnwindSafe,
impl<H, const DEPTH: u8> Send for CommitmentTree<H, DEPTH>where
H: Send,
impl<H, const DEPTH: u8> Sync for CommitmentTree<H, DEPTH>where
H: Sync,
impl<H, const DEPTH: u8> Unpin for CommitmentTree<H, DEPTH>where
H: Unpin,
impl<H, const DEPTH: u8> UnwindSafe for CommitmentTree<H, DEPTH>where
H: 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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more