pub struct TaxonTree {
pub root: TaxonId,
pub children: HashMap<TaxonId, Vec<TaxonId>>,
/* private fields */
}
Expand description
Represents a taxonomy tree. Each node is a Taxon represented by its TaxonId.
Fields§
§root: TaxonId
The root taxon
children: HashMap<TaxonId, Vec<TaxonId>>
A map that maps each taxon to its children
Implementations§
source§impl TaxonTree
impl TaxonTree
sourcepub fn filter_ancestors<F>(&self, filter: F) -> Vec<Option<TaxonId>>
pub fn filter_ancestors<F>(&self, filter: F) -> Vec<Option<TaxonId>>
Returns a filtered list of taxons (or more specifically, their identifiers)
sourcepub fn child_count(&self, whose: TaxonId) -> usize
pub fn child_count(&self, whose: TaxonId) -> usize
Returns the amount of children a given taxon has in this tree.
sourcepub fn snapping(
&self,
taxons: &TaxonList,
ranked_only: bool
) -> Vec<Option<TaxonId>>
pub fn snapping( &self, taxons: &TaxonList, ranked_only: bool ) -> Vec<Option<TaxonId>>
Converts a list of taxons into their respective taxon id’s for this tree. Replaces each invalid (or unranked) taxon with it’s first valid (and ranked) ancestor.
§Arguments:
taxons
: a vector of taxons, indexed by their TaxonId.ranked_only
: whether to include only taxons with a rank.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for TaxonTree
impl Send for TaxonTree
impl Sync for TaxonTree
impl Unpin for TaxonTree
impl UnwindSafe for TaxonTree
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