Struct tlsn_core::merkle::MerkleTree
source · pub struct MerkleTree(pub MerkleTree<Sha256>);
Expand description
A Merkle tree.
Tuple Fields§
§0: MerkleTree<Sha256>
Implementations§
source§impl MerkleTree
impl MerkleTree
sourcepub fn from_leaves(leaves: &[Hash]) -> Result<Self, MerkleError>
pub fn from_leaves(leaves: &[Hash]) -> Result<Self, MerkleError>
Create a new Merkle tree from the given leaves
sourcepub fn proof(&self, indices: &[usize]) -> MerkleProof
pub fn proof(&self, indices: &[usize]) -> MerkleProof
Creates an inclusion proof for the given indices
§Panics
- if
indices
is not sorted. - if
indices
contains duplicates
sourcepub fn root(&self) -> MerkleRoot
pub fn root(&self) -> MerkleRoot
Returns the Merkle root for this MerkleTree
Trait Implementations§
source§impl Clone for MerkleTree
impl Clone for MerkleTree
source§fn clone(&self) -> MerkleTree
fn clone(&self) -> MerkleTree
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 Default for MerkleTree
impl Default for MerkleTree
source§fn default() -> MerkleTree
fn default() -> MerkleTree
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for MerkleTree
impl<'de> Deserialize<'de> for MerkleTree
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MerkleTree
impl RefUnwindSafe for MerkleTree
impl Send for MerkleTree
impl Sync for MerkleTree
impl Unpin 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
§impl<T> HashCommit for Twhere
T: Serialize,
impl<T> HashCommit for Twhere
T: Serialize,
§fn hash_commit(self) -> (Decommitment<Self>, Hash)
fn hash_commit(self) -> (Decommitment<Self>, Hash)
Creates a hash commitment to self
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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