#[non_exhaustive]pub struct ComponentReference {
pub identity: Resource,
pub identified: IdentifiedData,
pub feature: FeatureData,
pub in_child_of: Option<Resource>,
pub refers_to: Option<Resource>,
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.identity: Resource§identified: IdentifiedData§feature: FeatureData§in_child_of: Option<Resource>§refers_to: Option<Resource>Implementations§
Source§impl ComponentReference
impl ComponentReference
pub fn new( parent: &Resource, display_id: impl TryInto<DisplayId, Error = BuildError>, in_child_of: Resource, refers_to: Resource, ) -> Result<Self, BuildError>
pub fn builder( parent: &Resource, display_id: impl TryInto<DisplayId, Error = BuildError>, ) -> Result<ComponentReferenceBuilder, BuildError>
Source§impl ComponentReference
impl ComponentReference
Sourcepub fn parent_component<'a>(&self, doc: &'a Document) -> Option<&'a Component>
pub fn parent_component<'a>(&self, doc: &'a Document) -> Option<&'a Component>
Returns the Component that owns this feature via
sbol:hasFeature, or None if no enclosing component is
in the document. SBOL features must belong to exactly one
component, so a Some result is unambiguous.
Source§impl ComponentReference
impl ComponentReference
Sourcepub fn target<'a, G>(
&self,
graph: &'a G,
) -> Result<FeatureRef<'a>, ReferenceError>where
G: ObjectGraph + ?Sized,
pub fn target<'a, G>(
&self,
graph: &'a G,
) -> Result<FeatureRef<'a>, ReferenceError>where
G: ObjectGraph + ?Sized,
Resolves the leaf FeatureRef that this reference points at.
Equivalent to ComponentReference::trace followed by
FeatureTrace::target. Use trace when the
intermediate hops matter.
Sourcepub fn trace<'a, G>(
&self,
graph: &'a G,
) -> Result<FeatureTrace<'a>, ReferenceError>where
G: ObjectGraph + ?Sized,
pub fn trace<'a, G>(
&self,
graph: &'a G,
) -> Result<FeatureTrace<'a>, ReferenceError>where
G: ObjectGraph + ?Sized,
Walks the refersTo chain from this reference to its leaf feature.
Returns a FeatureTrace carrying the resolved FeatureRef plus
the IRIs of every intermediate ComponentReference crossed.
§Errors
ReferenceError::Missingwhen this reference (or a node along the chain) has norefersTo.ReferenceError::NotFoundwhen an IRI along the chain is absent fromgraph.ReferenceError::WrongTypewhen the leaf is not a recognized Feature subclass.ReferenceError::Cyclewhen the chain loops back on itself.
Trait Implementations§
Source§impl Clone for ComponentReference
impl Clone for ComponentReference
Source§fn clone(&self) -> ComponentReference
fn clone(&self) -> ComponentReference
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ComponentReference
impl Debug for ComponentReference
Source§impl PartialEq for ComponentReference
impl PartialEq for ComponentReference
Source§fn eq(&self, other: &ComponentReference) -> bool
fn eq(&self, other: &ComponentReference) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl SbolIdentified for ComponentReference
impl SbolIdentified for ComponentReference
Source§fn identified_data(&self) -> &IdentifiedData
fn identified_data(&self) -> &IdentifiedData
Returns the underlying
IdentifiedData this accessor reads from.
Implementors only need to forward to their identified field.Source§fn display_id(&self) -> Option<&str>
fn display_id(&self) -> Option<&str>
The object’s
sbol:displayId, if present.Source§fn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
The object’s
sbol:description, if present.Source§fn derived_from(&self) -> &[Resource]
fn derived_from(&self) -> &[Resource]
Resources this object lists as
prov:wasDerivedFrom.Source§fn generated_by(&self) -> &[Resource]
fn generated_by(&self) -> &[Resource]
Resources this object lists as
prov:wasGeneratedBy.Source§fn extensions(&self) -> &[ExtensionTriple]
fn extensions(&self) -> &[ExtensionTriple]
Non-SBOL annotation triples preserved on this object’s identity.
Source§impl ToRdf for ComponentReference
impl ToRdf for ComponentReference
fn to_rdf_triples(&self) -> Result<Vec<Triple>, BuildError>
Source§impl TryFromObject for ComponentReference
impl TryFromObject for ComponentReference
fn try_from_object(object: &Object) -> Option<Self>
impl Eq for ComponentReference
impl StructuralPartialEq for ComponentReference
Auto Trait Implementations§
impl Freeze for ComponentReference
impl RefUnwindSafe for ComponentReference
impl Send for ComponentReference
impl Sync for ComponentReference
impl Unpin for ComponentReference
impl UnsafeUnpin for ComponentReference
impl UnwindSafe for ComponentReference
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