pub struct Tree<T: Default + Copy> {
pub root: TaxonId,
pub value: T,
pub children: Vec<Tree<T>>,
}
Expand description
A recursive tree of TaxonId’s and a label.
Fields§
§root: TaxonId
The root of the (sub)tree.
value: T
The label of this node.
children: Vec<Tree<T>>
The children of this node.
Implementations§
source§impl<T: Default + Copy> Tree<T>
impl<T: Default + Copy> Tree<T>
sourcepub fn new(
root: TaxonId,
parents: &[Option<TaxonId>],
taxons: &HashMap<TaxonId, T>
) -> Result<Self>
pub fn new( root: TaxonId, parents: &[Option<TaxonId>], taxons: &HashMap<TaxonId, T> ) -> Result<Self>
Create a new Tree.
root
will be the root taxon of the tree. In parents
, on index i should be the parent of
taxon with id i, if any. taxons
links taxa to their labels. Only taxon ids included in
taxons
and their ancestors will be in the tree.
Auto Trait Implementations§
impl<T> RefUnwindSafe for Tree<T>where
T: RefUnwindSafe,
impl<T> Send for Tree<T>where
T: Send,
impl<T> Sync for Tree<T>where
T: Sync,
impl<T> Unpin for Tree<T>where
T: Unpin,
impl<T> UnwindSafe for Tree<T>where
T: UnwindSafe,
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