pub struct Node(pub usize);Expand description
Represents a node in a tree by its index.
Tuple Fields§
§0: usizeImplementations§
Source§impl Node
impl Node
Sourcepub fn left_sibling(&self) -> Node
pub fn left_sibling(&self) -> Node
The left sibling of this node. Panics if node is not a right-side node.
Sourcepub fn right_sibling(&self) -> Node
pub fn right_sibling(&self) -> Node
The right sibling of this node. Panics if node is not a left-side node.
Sourcepub fn rightmost_descendent(&self) -> Node
pub fn rightmost_descendent(&self) -> Node
Finds the right-most node which is a descendent of this one.
Sourcepub fn leftmost_descendent(&self) -> Node
pub fn leftmost_descendent(&self) -> Node
Finds the left-most node which is a descendent of this one.
Sourcepub fn exists_at_length(&self, length: usize) -> bool
pub fn exists_at_length(&self, length: usize) -> bool
Determines if a log with the given number of elements would contain this node.
Sourcepub fn next_node_with_height(&self, height: u32) -> Node
pub fn next_node_with_height(&self, height: u32) -> Node
Finds the next node after this one with the specified height. The specified height MUST be less than or equal the height of this node.
Sourcepub fn first_node_with_height(height: u32) -> Node
pub fn first_node_with_height(height: u32) -> Node
Compute the left-most node which has a given height.
Sourcepub fn broots_for_len(length: usize) -> Vec<Node>
pub fn broots_for_len(length: usize) -> Vec<Node>
Compute the balanced roots for a log with a given log length in number of leaves.
Trait Implementations§
Source§impl Ord for Node
impl Ord for Node
Source§impl PartialOrd for Node
impl PartialOrd for Node
impl Copy for Node
impl Eq for Node
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.