pub struct MerkleTree { /* private fields */ }Expand description
A Merkle tree built from audit entry hashes.
Implementations§
Source§impl MerkleTree
impl MerkleTree
Sourcepub fn build(entries: &[AuditEntry]) -> Option<Self>
pub fn build(entries: &[AuditEntry]) -> Option<Self>
Build a Merkle tree from a slice of audit entries.
Returns None if the entries slice is empty.
Sourcepub fn leaf_count(&self) -> usize
pub fn leaf_count(&self) -> usize
Number of leaves (entries) in the tree.
Sourcepub fn proof(&self, index: usize) -> Option<MerkleProof>
pub fn proof(&self, index: usize) -> Option<MerkleProof>
Generate an inclusion proof for the entry at the given index.
Returns None if the index is out of bounds.
Trait Implementations§
Source§impl Clone for MerkleTree
impl Clone for MerkleTree
Source§fn clone(&self) -> MerkleTree
fn clone(&self) -> MerkleTree
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for MerkleTree
impl RefUnwindSafe for MerkleTree
impl Send for MerkleTree
impl Sync for MerkleTree
impl Unpin for MerkleTree
impl UnsafeUnpin for MerkleTree
impl UnwindSafe for MerkleTree
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