Skip to main content

Edge

Trait Edge 

Source
pub trait Edge<'graph> {
    type Graph: Graph;

    // Required methods
    fn new(
        id: <Self::Graph as Graph>::EdgeId,
        graph: &'graph Self::Graph,
    ) -> Self;
    fn id(&self) -> <Self::Graph as Graph>::EdgeId;
    fn graph(&self) -> &'graph Self::Graph;
    fn from_id(&self) -> <Self::Graph as Graph>::NodeId;
    fn to_id(&self) -> <Self::Graph as Graph>::NodeId;

    // Provided methods
    fn from(&self) -> <Self::Graph as Graph>::Node<'graph> { ... }
    fn to(&self) -> <Self::Graph as Graph>::Node<'graph> { ... }
    fn is_loop(&self) -> bool { ... }
}
Expand description

Typed edge handle trait for immutable graph references.

Required Associated Types§

Required Methods§

Source

fn new(id: <Self::Graph as Graph>::EdgeId, graph: &'graph Self::Graph) -> Self

Source

fn id(&self) -> <Self::Graph as Graph>::EdgeId

Returns this edge identifier.

Source

fn graph(&self) -> &'graph Self::Graph

Returns the backing graph reference for this edge.

Source

fn from_id(&self) -> <Self::Graph as Graph>::NodeId

Returns the source node’s id for this edge.

Source

fn to_id(&self) -> <Self::Graph as Graph>::NodeId

Returns the destination node’s id for this edge.

Provided Methods§

Source

fn from(&self) -> <Self::Graph as Graph>::Node<'graph>

Returns the source node for this edge

Source

fn to(&self) -> <Self::Graph as Graph>::Node<'graph>

Returns the destination node for this edge

Source

fn is_loop(&self) -> bool

Returns true when this edge starts and ends at the same node.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'graph, NodeId: Identifier, EdgeId: Identifier, NodeData, EdgeData> Edge<'graph> for EdgeRef<'graph, NodeId, EdgeId, NodeData, EdgeData>

Source§

type Graph = OwningGraph<NodeId, EdgeId, NodeData, EdgeData>