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 moresource§impl<H: PartialEq, const DEPTH: u8> PartialEq for CommitmentTree<H, DEPTH>
impl<H: PartialEq, const DEPTH: u8> PartialEq for CommitmentTree<H, DEPTH>
source§fn eq(&self, other: &CommitmentTree<H, DEPTH>) -> bool
fn eq(&self, other: &CommitmentTree<H, DEPTH>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<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