pub struct TaxonList(pub Vec<Option<Taxon>>);
Expand description
A newtype definition for a (pretty dense) list of taxons by ID.
Tuple Fields§
§0: Vec<Option<Taxon>>
Implementations§
source§impl TaxonList
impl TaxonList
sourcepub fn new_with_unknown(taxa: Vec<Taxon>, with_unknown: bool) -> Self
pub fn new_with_unknown(taxa: Vec<Taxon>, with_unknown: bool) -> Self
Returns an index of given taxa on their ID. The with_unknown flag allows the insertion of an unknown taxon on index 0 if that position isn’t taken.
sourcepub fn ancestry(&self) -> Vec<Option<TaxonId>>
pub fn ancestry(&self) -> Vec<Option<TaxonId>>
Constructs a vector mapping a TaxonId to the id of its parent, if it has one.
sourcepub fn get(&self, index: TaxonId) -> Option<&Taxon>
pub fn get(&self, index: TaxonId) -> Option<&Taxon>
Retrieve a taxon from the taxon list by id.
sourcepub fn get_or_unknown(&self, index: TaxonId) -> Result<&Taxon>
pub fn get_or_unknown(&self, index: TaxonId) -> Result<&Taxon>
Retrieve a taxon from the taxon list by id, returns UnknownTaxon if the taxon is not present.
Auto Trait Implementations§
impl RefUnwindSafe for TaxonList
impl Send for TaxonList
impl Sync for TaxonList
impl Unpin for TaxonList
impl UnwindSafe for TaxonList
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