pub trait Visit<Node, Edge = (), Impl = ()> {
type EdgesIntoIter: IntoIterator<Item = (Node, Edge)>;
type EdgesFuture: Future<Output = Result<Self::EdgesIntoIter>> + Send;
// Required method
fn edges(&mut self, node: &Node) -> Self::EdgesFuture;
// Provided methods
fn visit(&mut self, node: &Node, edge: Option<&Edge>) -> VisitControlFlow { ... }
fn span(&mut self, _node: &Node, _edge: Option<&Edge>) -> Span { ... }
}Expand description
A trait that allows a graph traversal to visit the edges of a node transitively.
Required Associated Types§
type EdgesIntoIter: IntoIterator<Item = (Node, Edge)>
type EdgesFuture: Future<Output = Result<Self::EdgesIntoIter>> + Send
Required Methods§
Sourcefn edges(&mut self, node: &Node) -> Self::EdgesFuture
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
edgesfutures created and awaited concurrently. - The returned future’s lifetime cannot depend on
nodebecauseGraphStore::insertreturns a node reference that’s only valid for the lifetime of its&mut selfreference.
Provided Methods§
Sourcefn visit(&mut self, node: &Node, edge: Option<&Edge>) -> VisitControlFlow
fn visit(&mut self, node: &Node, edge: Option<&Edge>) -> VisitControlFlow
Visits an edge. 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.