Struct light_phylogeny::ArenaTree
source · [−]Expand description
ArenaTree Structure. It describes a binary phylogenetic tree.
Inspirated from https://dev.to/deciduously/no-more-tears-no-more-knots-arena-allocated-trees-in-rust-44k6
Ben Lovy https://deciduously.com/
Fields
arena: Vec<Noeud<T>>
Implementations
sourceimpl<T> ArenaTree<T> where
T: PartialEq + Default + Debug,
impl<T> ArenaTree<T> where
T: PartialEq + Default + Debug,
sourcepub fn node(&mut self, val: T) -> usize
pub fn node(&mut self, val: T) -> usize
Add a node with a given val and send its new index. If the node already exists, send its index.
sourcepub fn new_node(&mut self, val: T) -> usize
pub fn new_node(&mut self, val: T) -> usize
Add a node with a given val and send its new index. If the node already exists, send a panic alert.
sourcepub fn get_node(&mut self, val: T) -> usize
pub fn get_node(&mut self, val: T) -> usize
Get the index of a node from its val. If the node does not exists, send a panic alert.
sourcepub fn get_index(&mut self, name: String) -> Result<usize, usize>
pub fn get_index(&mut self, name: String) -> Result<usize, usize>
Get the index of a node from its name. Send a Result(index, error)
sourcepub fn get_largest_x(&mut self) -> f32
pub fn get_largest_x(&mut self) -> f32
Get the largest x value of a tree.
sourcepub fn get_largest_y(&mut self) -> f32
pub fn get_largest_y(&mut self) -> f32
Get the largest y value of a tree.
sourcepub fn get_largest_y_nofl(&mut self) -> f32
pub fn get_largest_y_nofl(&mut self) -> f32
Get the largest y value of a tree execpt the free living part.
sourcepub fn get_smallest_x(&mut self) -> f32
pub fn get_smallest_x(&mut self) -> f32
Get the smallest x value of a tree.
sourcepub fn get_smallest_y(&mut self) -> f32
pub fn get_smallest_y(&mut self) -> f32
Get the smallest y value of a tree.
sourcepub fn get_smallest_l(&mut self) -> f32
pub fn get_smallest_l(&mut self) -> f32
Get the smallest l value of a tree.
sourcepub fn get_largest_height(&mut self) -> f32
pub fn get_largest_height(&mut self) -> f32
Get the largest height .
sourcepub fn shift_x_subtree(&mut self, idx: usize, shift: f32)
pub fn shift_x_subtree(&mut self, idx: usize, shift: f32)
Shift subtree on x .
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for ArenaTree<T> where
T: RefUnwindSafe,
impl<T> Send for ArenaTree<T> where
T: Send,
impl<T> Sync for ArenaTree<T> where
T: Sync,
impl<T> Unpin for ArenaTree<T> where
T: Unpin,
impl<T> UnwindSafe for ArenaTree<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more