Trait Visit

Source
pub trait Visit<Node, Abort = !, Impl = ()> {
    type Edge;
    type EdgesIntoIter: IntoIterator<Item = Self::Edge>;
    type EdgesFuture: Future<Output = Result<Self::EdgesIntoIter>> + Send;

    // Required methods
    fn visit(&mut self, edge: Self::Edge) -> VisitControlFlow<Node, Abort>;
    fn edges(&mut self, node: &Node) -> Self::EdgesFuture;

    // Provided method
    fn span(&mut self, node: &Node) -> Span { ... }
}
Expand description

A trait that allows a graph traversal to visit the edges of a node transitively.

Required Associated Types§

Required Methods§

Source

fn visit(&mut self, edge: Self::Edge) -> VisitControlFlow<Node, Abort>

Visits an edge to get to the neighbor node. Should return a VisitControlFlow that indicates whether to:

  • continue visiting the neighbor node edges;
  • skip visiting the neighbor node’s edges;
  • abort the traversal entirely.
Source

fn edges(&mut self, node: &Node) -> Self::EdgesFuture

Returns a future that resolves to the outgoing edges of the given node.

Lifetimes:

  • The returned future’s lifetime cannot depend on the reference to self because there are multiple edges futures created and awaited concurrently.
  • The returned future’s lifetime cannot depend on node because GraphStore::insert returns a node reference that’s only valid for the lifetime of its &mut self reference.

Provided Methods§

Source

fn span(&mut self, node: &Node) -> Span

Returns a [Span] for the given node, under which all edges are processed.

Implementors§