[][src]Trait rustc_ap_rustc_data_structures::graph::iterate::TriColorVisitor

pub trait TriColorVisitor<G: ?Sized> where
    G: DirectedGraph
{ type BreakVal; fn node_examined(
        &mut self,
        _target: G::Node,
        _prior_status: Option<NodeStatus>
    ) -> ControlFlow<Self::BreakVal> { ... }
fn node_settled(&mut self, _target: G::Node) -> ControlFlow<Self::BreakVal> { ... } }

What to do when a node is examined or becomes Settled during DFS.

Associated Types

type BreakVal

The value returned by this search.

Loading content...

Provided methods

fn node_examined(
    &mut self,
    _target: G::Node,
    _prior_status: Option<NodeStatus>
) -> ControlFlow<Self::BreakVal>

Called when a node is examined by the depth-first search.

By checking the value of prior_status, this visitor can determine whether the edge leading to this node was a tree edge (None), forward edge (Some(Settled)) or back edge (Some(Visited)). For a full explanation of each edge type, see the "Depth-first Search" chapter in CLR or wikipedia.

If you want to know both nodes linked by each edge, you'll need to modify TriColorDepthFirstSearch to store a source node for each Visited event.

fn node_settled(&mut self, _target: G::Node) -> ControlFlow<Self::BreakVal>

Called after all nodes reachable from this one have been examined.

Loading content...

Implementors

impl<G: ?Sized> TriColorVisitor<G> for CycleDetector where
    G: DirectedGraph
[src]

type BreakVal = ()

Loading content...