pub struct Tree { /* private fields */ }Expand description
A radix-4 tree.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn nb_nodes_for_leaves(nb_leaves: usize) -> usize
pub fn nb_nodes_for_leaves(nb_leaves: usize) -> usize
Calculate the total number of nodes a tree would have for the given number of leaves.
pub fn new(nb_leaves: usize) -> Tree
pub fn nb_leaves(&self) -> usize
pub fn nb_nodes(&self) -> usize
pub fn root(&self) -> &Node
Sourcepub fn iter(&self) -> Iter<'_, Node>
pub fn iter(&self) -> Iter<'_, Node>
Iterate over all nodes, starting with the leaves, towards the root.
Sourcepub fn into_iter(self) -> IntoIter<Node>
pub fn into_iter(self) -> IntoIter<Node>
Iterate over all nodes, starting with the leaves, towards the root.
Sourcepub fn iter_branch(&self, leaf_idx: usize) -> BranchIter<'_> ⓘ
pub fn iter_branch(&self, leaf_idx: usize) -> BranchIter<'_> ⓘ
Iterate nodes over a branch starting at the leaf
with index leaf_idx ending in the root.
pub fn parent_idx_of(&self, idx: usize) -> Option<usize>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnwindSafe for Tree
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