Struct incrementalmerkletree::Position
source · pub struct Position(/* private fields */);
Expand description
A type representing the position of a leaf in a Merkle tree.
Implementations§
source§impl Position
impl Position
sourcepub fn is_right_child(&self) -> bool
pub fn is_right_child(&self) -> bool
Return whether the position refers to the right-hand child of a subtree with its root at level 1.
sourcepub fn root_level(&self) -> Level
pub fn root_level(&self) -> Level
Returns the minimum possible level of the root of a binary tree containing at least
self + 1
leaves.
sourcepub fn past_ommer_count(&self) -> u8
pub fn past_ommer_count(&self) -> u8
Returns the number of cousins and/or ommers required to construct an authentication
path to the root of a merkle tree that has self + 1
leaves.
sourcepub fn is_complete_subtree(&self, root_level: Level) -> bool
pub fn is_complete_subtree(&self, root_level: Level) -> bool
Returns whether the binary tree having self
as the position of the rightmost leaf
contains a perfect balanced tree with a root at level root_level
that contains the
aforesaid leaf.
sourcepub fn witness_addrs(
&self,
root_level: Level
) -> impl Iterator<Item = (Address, Source)>
pub fn witness_addrs( &self, root_level: Level ) -> impl Iterator<Item = (Address, Source)>
Returns an iterator over the addresses of nodes required to create a witness for this position, beginning with the sibling of the leaf at this position and ending with the sibling of the ancestor of the leaf at this position that is required to compute a root at the specified level.
Trait Implementations§
source§impl AddAssign<u64> for Position
impl AddAssign<u64> for Position
source§fn add_assign(&mut self, other: u64)
fn add_assign(&mut self, other: u64)
+=
operation. Read moresource§impl Ord for Position
impl Ord for Position
source§impl PartialEq for Position
impl PartialEq for Position
source§impl PartialOrd for Position
impl PartialOrd for Position
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more