pub struct TreeNode(_);Expand description
An u64 that defines a node in a bao tree.
You typically don’t have to use this, but it can be useful for debugging
and error handling. Hash validation errors contain a TreeNode that allows
you to find the position where validation failed.
Implementations§
source§impl TreeNode
impl TreeNode
pub const fn mid(&self) -> BlockNum
pub const fn level(&self) -> u32
pub const fn is_leaf(&self) -> bool
pub fn byte_range(&self, block_size: BlockSize) -> Range<ByteNum>
pub const fn as_leaf(&self) -> Option<LeafNode>
pub const fn count_below(&self) -> u64
sourcepub fn next_left_ancestor(&self) -> Option<Self>
pub fn next_left_ancestor(&self) -> Option<Self>
Get the next left ancestor of this node, or None if there is none.
pub fn left_child(&self) -> Option<Self>
pub fn right_child(&self) -> Option<Self>
sourcepub fn parent(&self) -> Option<Self>
pub fn parent(&self) -> Option<Self>
Unrestricted parent, can only be None if we are at the top
sourcepub fn restricted_parent(&self, len: Self) -> Option<Self>
pub fn restricted_parent(&self, len: Self) -> Option<Self>
Restricted parent, will be None if we call parent on the root
pub const fn node_range(&self) -> Range<Self>
pub fn block_range(&self) -> Range<BlockNum>
pub fn post_order_offset(&self) -> u64
sourcepub fn right_count(&self) -> u32
pub fn right_count(&self) -> u32
the number of times you have to go right from the root to get to this node
0 for a root node
pub fn post_order_range(&self) -> Range<u64>
Trait Implementations§
source§impl Ord for TreeNode
impl Ord for TreeNode
source§impl PartialEq<TreeNode> for TreeNode
impl PartialEq<TreeNode> for TreeNode
source§impl PartialOrd<TreeNode> for TreeNode
impl PartialOrd<TreeNode> for TreeNode
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 TreeNode
impl Eq for TreeNode
impl StructuralEq for TreeNode
impl StructuralPartialEq for TreeNode
Auto Trait Implementations§
impl RefUnwindSafe for TreeNode
impl Send for TreeNode
impl Sync for TreeNode
impl Unpin for TreeNode
impl UnwindSafe for TreeNode
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