pub struct Taxonomy { /* private fields */ }Expand description
An open registry of terms. Both AuthorityType and GuardianshipRole are Taxonomys.
Extensible: insert adds or replaces a term by id; nothing here is closed at compile time.
Implementations§
Source§impl Taxonomy
impl Taxonomy
Sourcepub fn from_terms(terms: impl IntoIterator<Item = TaxonomyTerm>) -> Self
pub fn from_terms(terms: impl IntoIterator<Item = TaxonomyTerm>) -> Self
Constructs from terms.
Sourcepub fn insert(&mut self, term: TaxonomyTerm)
pub fn insert(&mut self, term: TaxonomyTerm)
Add or replace a term (idempotent by id). This is the extensibility point — a bundled ontology, a jurisdiction pack, or a user extension can register additional terms.
Sourcepub fn extend_with(&mut self, other: &Taxonomy)
pub fn extend_with(&mut self, other: &Taxonomy)
Merge another taxonomy’s terms into this one (later terms win on id collision).
Sourcepub fn get(&self, id: &str) -> Option<&TaxonomyTerm>
pub fn get(&self, id: &str) -> Option<&TaxonomyTerm>
Gets a value.
Sourcepub fn in_category(&self, category_id: &str) -> Vec<&TaxonomyTerm>
pub fn in_category(&self, category_id: &str) -> Vec<&TaxonomyTerm>
All direct members of a category (by category term id).
Sourcepub fn all(&self) -> &[TaxonomyTerm]
pub fn all(&self) -> &[TaxonomyTerm]
All entries.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Taxonomy
impl<'de> Deserialize<'de> for Taxonomy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Taxonomy
impl StructuralPartialEq for Taxonomy
Auto Trait Implementations§
impl Freeze for Taxonomy
impl RefUnwindSafe for Taxonomy
impl Send for Taxonomy
impl Sync for Taxonomy
impl Unpin for Taxonomy
impl UnsafeUnpin for Taxonomy
impl UnwindSafe for Taxonomy
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