pub struct Relations { /* private fields */ }Expand description
The typed edges of a code system, both ways.
Implementations§
Source§impl Relations
impl Relations
Sourcepub fn build(
nodes: u32,
types: Vec<String>,
edges: Vec<(Ordinal, u32, Ordinal)>,
) -> Result<Self, RelationsError>
pub fn build( nodes: u32, types: Vec<String>, edges: Vec<(Ordinal, u32, Ordinal)>, ) -> Result<Self, RelationsError>
Builds the relations of nodes nodes from (source, type, target) edges.
§Errors
Returns RelationsError::OutOfRange for an edge beyond nodes or
beyond the type list.
Sourcepub fn outgoing(
&self,
node: Ordinal,
) -> impl Iterator<Item = (u32, Ordinal)> + '_
pub fn outgoing( &self, node: Ordinal, ) -> impl Iterator<Item = (u32, Ordinal)> + '_
The (type, target) pairs leaving node, by type then target.
Sourcepub fn incoming(
&self,
node: Ordinal,
) -> impl Iterator<Item = (u32, Ordinal)> + '_
pub fn incoming( &self, node: Ordinal, ) -> impl Iterator<Item = (u32, Ordinal)> + '_
The (type, source) pairs arriving at node, by type then source.
Sourcepub fn sources(
&self,
node: Ordinal,
kind: u32,
) -> impl Iterator<Item = Ordinal> + '_
pub fn sources( &self, node: Ordinal, kind: u32, ) -> impl Iterator<Item = Ordinal> + '_
The sources of edges of type kind arriving at node.
Sourcepub fn targets(
&self,
node: Ordinal,
kind: u32,
) -> impl Iterator<Item = Ordinal> + '_
pub fn targets( &self, node: Ordinal, kind: u32, ) -> impl Iterator<Item = Ordinal> + '_
The targets of edges of type kind leaving node.
Sourcepub fn read_from(input: &mut impl Read) -> Result<Self, RelationsError>
pub fn read_from(input: &mut impl Read) -> Result<Self, RelationsError>
Reads the layout.
§Errors
Returns RelationsError for a truncated, foreign, or inconsistent artifact.
Trait Implementations§
impl Eq for Relations
impl StructuralPartialEq for Relations
Auto Trait Implementations§
impl Freeze for Relations
impl RefUnwindSafe for Relations
impl Send for Relations
impl Sync for Relations
impl Unpin for Relations
impl UnsafeUnpin for Relations
impl UnwindSafe for Relations
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