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§
type Edge
type EdgesIntoIter: IntoIterator<Item = Self::Edge>
type EdgesFuture: Future<Output = Result<Self::EdgesIntoIter>> + Send
Required Methods§
Sourcefn visit(&mut self, edge: Self::Edge) -> VisitControlFlow<Node, Abort>
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.
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
edges
futures created and awaited concurrently. - The returned future’s lifetime cannot depend on
node
becauseGraphStore::insert
returns a node reference that’s only valid for the lifetime of its&mut self
reference.