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
sourcepub fn byte_range(&self, block_size: BlockSize) -> Range<ByteNum>
pub fn byte_range(&self, block_size: BlockSize) -> Range<ByteNum>
Range of blocks that this node covers, given a block size
sourcepub const fn as_leaf(&self) -> Option<LeafNode>
pub const fn as_leaf(&self) -> Option<LeafNode>
Convert to a leaf node, if this is a leaf node.
sourcepub const fn count_below(&self) -> u64
pub const fn count_below(&self) -> u64
Number of nodes below this node, excluding this node.
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.
sourcepub fn left_child(&self) -> Option<Self>
pub fn left_child(&self) -> Option<Self>
Get the left child of this node, or None if it is a child node.
sourcepub fn right_child(&self) -> Option<Self>
pub fn right_child(&self) -> Option<Self>
Get the right child of this node, or None if it is a child node.
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
sourcepub const fn node_range(&self) -> Range<Self>
pub const fn node_range(&self) -> Range<Self>
Get the range of nodes this node covers
sourcepub fn block_range(&self) -> Range<BlockNum>
pub fn block_range(&self) -> Range<BlockNum>
Get the range of blocks this node covers
sourcepub fn post_order_offset(&self) -> u64
pub fn post_order_offset(&self) -> u64
Get the post order offset of this node
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
sourcepub fn post_order_range(&self) -> Range<u64>
pub fn post_order_range(&self) -> Range<u64>
Get the range of post order offsets this node covers
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
self
and other
) and is used by the <=
operator. Read more