pub struct InclusionProof<H: Digest> { /* private fields */ }Expand description
A proof that a value appears in a Merkle tree
Implementations§
Source§impl<H: Digest> InclusionProof<H>
impl<H: Digest> InclusionProof<H>
Sourcepub fn as_bytes(&self) -> &[u8]
pub fn as_bytes(&self) -> &[u8]
Returns the byte representation of this inclusion proof.
This is precisely PATH(m, D[n]), described in RFC 6962
§2.1.1, where n is the number
of leaves and m is the leaf index being proved.
Sourcepub fn from_bytes(bytes: Vec<u8>) -> Self
pub fn from_bytes(bytes: Vec<u8>) -> Self
Constructs an InclusionProof from its serialized form.
§Panics
Panics when bytes.len() is not a multiple of H::OutputSize::USIZE, i.e., when bytes is
not a concatenated sequence of hash digests.
Sourcepub fn from_digests<'a>(
digests: impl IntoIterator<Item = &'a Output<H>>,
) -> Self
pub fn from_digests<'a>( digests: impl IntoIterator<Item = &'a Output<H>>, ) -> Self
Constructs an InclusionProof from a sequence of digests.
Sourcepub fn try_from_bytes(bytes: Vec<u8>) -> Result<Self, InclusionVerifError>
pub fn try_from_bytes(bytes: Vec<u8>) -> Result<Self, InclusionVerifError>
Constructs a InclusionProof from the given bytes.
§Errors
If when bytes.len() is not a multiple of H::OutputSize::USIZE, i.e., when bytes
is not a concatenated sequence of hash digests.
Trait Implementations§
Source§impl<H: Clone + Digest> Clone for InclusionProof<H>
impl<H: Clone + Digest> Clone for InclusionProof<H>
Source§fn clone(&self) -> InclusionProof<H>
fn clone(&self) -> InclusionProof<H>
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 moreimpl<H: Eq + Digest> Eq for InclusionProof<H>
impl<H: Digest> StructuralPartialEq for InclusionProof<H>
Auto Trait Implementations§
impl<H> Freeze for InclusionProof<H>
impl<H> RefUnwindSafe for InclusionProof<H>where
H: RefUnwindSafe,
impl<H> Send for InclusionProof<H>where
H: Send,
impl<H> Sync for InclusionProof<H>where
H: Sync,
impl<H> Unpin for InclusionProof<H>where
H: Unpin,
impl<H> UnwindSafe for InclusionProof<H>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