pub enum EntityFrame {
Typedef(Box<TypedefFrame>),
Term(Box<TermFrame>),
Instance(Box<InstanceFrame>),
}
Expand description
An entity frame, describing either a term, an instance, or a typedef.
§Ordering
Serializer conventions
dictate that frames should be Serialized first with [Typedef]
frames, then
[Term]
, and then [Instance]
, which is reflected here in the order of the
variants.
Variants§
Implementations§
Source§impl EntityFrame
impl EntityFrame
Sourcepub fn as_term(&self) -> Option<&TermFrame>
pub fn as_term(&self) -> Option<&TermFrame>
Return a reference to the TermFrame
if the entity frame is one, or None
.
Use this function in conjunction with Iterator::flat_map
to extract
all term frames from an iterator of EntityFrame
references:
let doc = fastobo::from_file("tests/data/ms.obo").unwrap();
let terms: Vec<&TermFrame> = doc
.entities()
.iter()
.flat_map(EntityFrame::as_term)
.collect();
Sourcepub fn as_term_mut(&mut self) -> Option<&mut TermFrame>
pub fn as_term_mut(&mut self) -> Option<&mut TermFrame>
Return a mutable reference to the TermFrame
if the entity frame is one, or None
.
Sourcepub fn as_typedef(&self) -> Option<&TypedefFrame>
pub fn as_typedef(&self) -> Option<&TypedefFrame>
Return a reference to the TypedefFrame
if the entity frame is one, or None
.
Sourcepub fn as_typedef_mut(&mut self) -> Option<&mut TypedefFrame>
pub fn as_typedef_mut(&mut self) -> Option<&mut TypedefFrame>
Return a mutable reference to the TypedefFrame
if the entity frame is one, or None
.
Sourcepub fn as_instance(&self) -> Option<&InstanceFrame>
pub fn as_instance(&self) -> Option<&InstanceFrame>
Return a reference to the InstanceFrame
if the entity frame is one, or None
.
Sourcepub fn as_instance_mut(&mut self) -> Option<&mut InstanceFrame>
pub fn as_instance_mut(&mut self) -> Option<&mut InstanceFrame>
Return a mutable reference to the InstanceFrame
if the entity frame is one, or None
.
Sourcepub fn name(&self) -> Result<&UnquotedString, CardinalityError>
pub fn name(&self) -> Result<&UnquotedString, CardinalityError>
Get the name of the entity, if exactly one is declared.
Sourcepub fn definition(&self) -> Result<&Definition, CardinalityError>
pub fn definition(&self) -> Result<&Definition, CardinalityError>
Get the definition of the entity, if exactly one is declared.
Trait Implementations§
Source§impl Clone for EntityFrame
impl Clone for EntityFrame
Source§fn clone(&self) -> EntityFrame
fn clone(&self) -> EntityFrame
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more