Struct merkletree::proof::Proof
source · pub struct Proof<T: Eq + Clone + AsRef<[u8]>, BaseTreeArity: Unsigned = U2> {
pub sub_tree_proof: Option<Box<Proof<T, BaseTreeArity>>>,
/* private fields */
}
Expand description
Merkle tree inclusion proof for data element, for which item = Leaf(Hash(Data Item)).
Lemma layout:
[ item h1x h2y h3z ... root ]
Proof validation is positioned hash against lemma path to match root hash. U is the default tree arity (U2 = binary)
Fields§
§sub_tree_proof: Option<Box<Proof<T, BaseTreeArity>>>
Implementations§
source§impl<T: Eq + Clone + AsRef<[u8]>, BaseTreeArity: Unsigned> Proof<T, BaseTreeArity>
impl<T: Eq + Clone + AsRef<[u8]>, BaseTreeArity: Unsigned> Proof<T, BaseTreeArity>
sourcepub fn new<TopLayerArity: Unsigned, SubTreeArity: Unsigned>(
sub_tree_proof: Option<Box<Proof<T, BaseTreeArity>>>,
lemma: Vec<T>,
path: Vec<usize>,
) -> Result<Proof<T, BaseTreeArity>>
pub fn new<TopLayerArity: Unsigned, SubTreeArity: Unsigned>( sub_tree_proof: Option<Box<Proof<T, BaseTreeArity>>>, lemma: Vec<T>, path: Vec<usize>, ) -> Result<Proof<T, BaseTreeArity>>
Creates new MT inclusion proof
sourcepub fn sub_tree_root(&self) -> T
pub fn sub_tree_root(&self) -> T
Return sub tree root
sourcepub fn validate_with_data<A: Algorithm<T>>(
&self,
leaf_data: &dyn Hashable<A>,
) -> Result<bool>
pub fn validate_with_data<A: Algorithm<T>>( &self, leaf_data: &dyn Hashable<A>, ) -> Result<bool>
Verifies MT inclusion proof and that leaf_data is the original leaf data for which proof was generated.
pub fn top_layer_nodes(&self) -> usize
pub fn sub_layer_nodes(&self) -> usize
Trait Implementations§
source§impl<T: Clone + Eq + Clone + AsRef<[u8]>, BaseTreeArity: Clone + Unsigned> Clone for Proof<T, BaseTreeArity>
impl<T: Clone + Eq + Clone + AsRef<[u8]>, BaseTreeArity: Clone + Unsigned> Clone for Proof<T, BaseTreeArity>
source§impl<T: Debug + Eq + Clone + AsRef<[u8]>, BaseTreeArity: Debug + Unsigned> Debug for Proof<T, BaseTreeArity>
impl<T: Debug + Eq + Clone + AsRef<[u8]>, BaseTreeArity: Debug + Unsigned> Debug for Proof<T, BaseTreeArity>
source§impl<T: PartialEq + Eq + Clone + AsRef<[u8]>, BaseTreeArity: PartialEq + Unsigned> PartialEq for Proof<T, BaseTreeArity>
impl<T: PartialEq + Eq + Clone + AsRef<[u8]>, BaseTreeArity: PartialEq + Unsigned> PartialEq for Proof<T, BaseTreeArity>
impl<T: Eq + Eq + Clone + AsRef<[u8]>, BaseTreeArity: Eq + Unsigned> Eq for Proof<T, BaseTreeArity>
impl<T: Eq + Clone + AsRef<[u8]>, BaseTreeArity: Unsigned> StructuralPartialEq for Proof<T, BaseTreeArity>
Auto Trait Implementations§
impl<T, BaseTreeArity> Freeze for Proof<T, BaseTreeArity>
impl<T, BaseTreeArity> RefUnwindSafe for Proof<T, BaseTreeArity>where
BaseTreeArity: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, BaseTreeArity> Send for Proof<T, BaseTreeArity>
impl<T, BaseTreeArity> Sync for Proof<T, BaseTreeArity>
impl<T, BaseTreeArity> Unpin for Proof<T, BaseTreeArity>
impl<T, BaseTreeArity> UnwindSafe for Proof<T, BaseTreeArity>where
BaseTreeArity: UnwindSafe,
T: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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