pub struct ConsistencyProof<H: Digest> { /* private fields */ }Expand description
A proof that one Merkle tree is a prefix of another. In other words, tree #2 is the result of appending some number of items to the end of tree #1.
Implementations§
Source§impl<H: Digest> ConsistencyProof<H>
impl<H: Digest> ConsistencyProof<H>
Sourcepub fn as_bytes(&self) -> &[u8]
pub fn as_bytes(&self) -> &[u8]
Returns the byte representation of this consistency proof.
This is precisely PROOF(m, D[n]), described in RFC 6962
§2.1.2, where n is the number
of leaves and m is the leaf index being proved.
Sourcepub fn try_from_bytes(bytes: Vec<u8>) -> Result<Self, ConsistencyVerifError>
pub fn try_from_bytes(bytes: Vec<u8>) -> Result<Self, ConsistencyVerifError>
Constructs a ConsistencyProof 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.
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 a ConsistencyProof from a sequence of digests.
Trait Implementations§
Source§impl<H: Clone + Digest> Clone for ConsistencyProof<H>
impl<H: Clone + Digest> Clone for ConsistencyProof<H>
Source§fn clone(&self) -> ConsistencyProof<H>
fn clone(&self) -> ConsistencyProof<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 moreAuto Trait Implementations§
impl<H> Freeze for ConsistencyProof<H>
impl<H> RefUnwindSafe for ConsistencyProof<H>where
H: RefUnwindSafe,
impl<H> Send for ConsistencyProof<H>where
H: Send,
impl<H> Sync for ConsistencyProof<H>where
H: Sync,
impl<H> Unpin for ConsistencyProof<H>where
H: Unpin,
impl<H> UnwindSafe for ConsistencyProof<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