Struct fastobo::visit::IdCompactor

source ·
pub struct IdCompactor { /* private fields */ }
Expand description

A visitor that will compact identifiers in an OBO document.

Usage

The compactor will follow the rules from the OBO specification:

  • if the document declares an IDSpace prefix p that maps to an Url u, URL identifiers that can be factorized as {u}{v} will be replaced by Prefixed identifiers {p}:{v}
  • if the document does not declare an IDSpace p', URL identifiers that can be factorized as http://purl.obolibrary.org/obo/{p'}_{id} will be replaced by Prefixed identifiers {p'}:{id}.

Example

let mut doc = fastobo::from_str(
"[Term]
id: http://purl.obolibrary.org/obo/BFO_0000055
").unwrap();

IdCompactor::new().visit_doc(&mut doc);
assert_eq!(doc.to_string(),
"[Term]
id: BFO:0000055
");

See also

Implementations§

source§

impl IdCompactor

source

pub fn new() -> Self

Trait Implementations§

source§

impl Clone for IdCompactor

source§

fn clone(&self) -> IdCompactor

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for IdCompactor

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for IdCompactor

source§

fn default() -> IdCompactor

Returns the “default value” for a type. Read more
source§

impl VisitMut for IdCompactor

source§

fn visit_header_frame(&mut self, header: &mut HeaderFrame)

source§

fn visit_ident(&mut self, id: &mut Ident)

source§

fn visit_class_ident(&mut self, id: &mut ClassIdent)

source§

fn visit_creation_date(&mut self, creation_date: &mut CreationDate)

source§

fn visit_definition(&mut self, id: &mut Definition)

source§

fn visit_doc(&mut self, doc: &mut OboDoc)

source§

fn visit_entity_frame(&mut self, frame: &mut EntityFrame)

source§

fn visit_header_clause(&mut self, clause: &mut HeaderClause)

source§

fn visit_ident_prefix(&mut self, prefix: &mut IdentPrefix)

source§

fn visit_import(&mut self, import: &mut Import)

source§

fn visit_instance_clause(&mut self, clause: &mut InstanceClause)

source§

fn visit_instance_frame(&mut self, frame: &mut InstanceFrame)

source§

fn visit_instance_ident(&mut self, id: &mut InstanceIdent)

source§

fn visit_iso_date(&mut self, date: &mut IsoDate)

source§

fn visit_iso_datetime(&mut self, datetime: &mut IsoDateTime)

source§

fn visit_iso_time(&mut self, time: &mut IsoTime)

source§

fn visit_literal_property_value(&mut self, id: &mut LiteralPropertyValue)

source§

fn visit_naive_date(&mut self, date: &mut NaiveDateTime)

source§

fn visit_namespace_ident(&mut self, id: &mut NamespaceIdent)

source§

fn visit_property_value(&mut self, pv: &mut PropertyValue)

source§

fn visit_prefixed_ident(&mut self, id: &mut PrefixedIdent)

source§

fn visit_quoted_string(&mut self, string: &mut QuotedString)

source§

fn visit_relation_ident(&mut self, id: &mut RelationIdent)

source§

fn visit_resource_property_value(&mut self, id: &mut ResourcePropertyValue)

source§

fn visit_subset_ident(&mut self, id: &mut SubsetIdent)

source§

fn visit_synonym(&mut self, syn: &mut Synonym)

source§

fn visit_synonym_scope(&mut self, scope: &mut SynonymScope)

source§

fn visit_synonymtype_ident(&mut self, id: &mut SynonymTypeIdent)

source§

fn visit_term_clause(&mut self, clause: &mut TermClause)

source§

fn visit_term_frame(&mut self, frame: &mut TermFrame)

source§

fn visit_typedef_clause(&mut self, clause: &mut TypedefClause)

source§

fn visit_typedef_frame(&mut self, frame: &mut TypedefFrame)

source§

fn visit_unprefixed_ident(&mut self, string: &mut UnprefixedIdent)

source§

fn visit_unquoted_string(&mut self, string: &mut UnquotedString)

source§

fn visit_url(&mut self, url: &mut Url)

source§

fn visit_xref(&mut self, xref: &mut Xref)

source§

fn visit_xref_list(&mut self, xrefs: &mut XrefList)

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.