pub struct PathSegment { /* private fields */ }Expand description
One parsed step of a relationship path.
Implementations§
Source§impl PathSegment
impl PathSegment
Sourcepub fn parse(text: &str) -> Result<Self, String>
pub fn parse(text: &str) -> Result<Self, String>
Parses Relationship[|Relationship…][:direction][+].
§Errors
Returns why the text is no step: an empty alternative, one named
twice, a direction other than forward, backward or either, or a
direction written after an alternative other than the last.
Sourcepub fn relationships(&self) -> &[SemanticRelationship]
pub fn relationships(&self) -> &[SemanticRelationship]
The relationships the step may take, in the order written.
Sourcepub fn direction(&self) -> TraversalDirection
pub fn direction(&self) -> TraversalDirection
The direction every alternative is taken in.
Sourcepub fn walk(
&self,
service: &RelationshipSelectionServiceHandle,
from: &ObjectId,
everything: &[ObjectId],
scope: &[ObjectId],
chain: bool,
absent_ends: AbsentEndPolicy,
) -> Result<(BTreeSet<ObjectId>, Vec<Evidence>), RelationshipSelectionError>
pub fn walk( &self, service: &RelationshipSelectionServiceHandle, from: &ObjectId, everything: &[ObjectId], scope: &[ObjectId], chain: bool, absent_ends: AbsentEndPolicy, ) -> Result<(BTreeSet<ObjectId>, Vec<Evidence>), RelationshipSelectionError>
The objects of scope the step reaches from from, taken once or,
with chain, one or more times, with the service’s evidence.
A chain through several relationships hops between objects of
everything, each hop following any alternative’s own chain, and
keeps what lies in scope. from is never among the result.
§Errors
Returns the service’s error for the first query it cannot answer completely.