Struct miden_objects::crypto::merkle::InOrderIndex
source · pub struct InOrderIndex { /* private fields */ }Expand description
Index of nodes in a perfectly balanced binary tree based on an in-order tree walk.
Implementations§
source§impl InOrderIndex
impl InOrderIndex
sourcepub fn new(idx: NonZero<usize>) -> InOrderIndex
pub fn new(idx: NonZero<usize>) -> InOrderIndex
Returns a new InOrderIndex instantiated from the provided value.
sourcepub fn from_leaf_pos(leaf: usize) -> InOrderIndex
pub fn from_leaf_pos(leaf: usize) -> InOrderIndex
Return a new InOrderIndex instantiated from the specified leaf position.
§Panics:
If leaf is higher than or equal to usize::MAX / 2.
sourcepub fn is_leaf(&self) -> bool
pub fn is_leaf(&self) -> bool
True if the index is pointing at a leaf.
Every odd number represents a leaf.
sourcepub fn is_left_child(&self) -> bool
pub fn is_left_child(&self) -> bool
Returns true if this note is a left child of its parent.
sourcepub fn level(&self) -> u32
pub fn level(&self) -> u32
Returns the level of the index.
Starts at level zero for leaves and increases by one for each parent.
sourcepub fn left_child(&self) -> InOrderIndex
pub fn left_child(&self) -> InOrderIndex
sourcepub fn right_child(&self) -> InOrderIndex
pub fn right_child(&self) -> InOrderIndex
sourcepub fn parent(&self) -> InOrderIndex
pub fn parent(&self) -> InOrderIndex
Returns the index of the parent node.
sourcepub fn sibling(&self) -> InOrderIndex
pub fn sibling(&self) -> InOrderIndex
Returns the index of the sibling node.
sourcepub fn inner(&self) -> u64
pub fn inner(&self) -> u64
Returns the inner value of this InOrderIndex.
Trait Implementations§
source§impl Clone for InOrderIndex
impl Clone for InOrderIndex
source§fn clone(&self) -> InOrderIndex
fn clone(&self) -> InOrderIndex
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 Debug for InOrderIndex
impl Debug for InOrderIndex
source§impl Ord for InOrderIndex
impl Ord for InOrderIndex
source§fn cmp(&self, other: &InOrderIndex) -> Ordering
fn cmp(&self, other: &InOrderIndex) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for InOrderIndex
impl PartialEq for InOrderIndex
source§fn eq(&self, other: &InOrderIndex) -> bool
fn eq(&self, other: &InOrderIndex) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd for InOrderIndex
impl PartialOrd for InOrderIndex
source§fn partial_cmp(&self, other: &InOrderIndex) -> Option<Ordering>
fn partial_cmp(&self, other: &InOrderIndex) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for InOrderIndex
impl Eq for InOrderIndex
impl StructuralPartialEq for InOrderIndex
Auto Trait Implementations§
impl Freeze for InOrderIndex
impl RefUnwindSafe for InOrderIndex
impl Send for InOrderIndex
impl Sync for InOrderIndex
impl Unpin for InOrderIndex
impl UnwindSafe for InOrderIndex
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> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)