pub trait Cycles {
type NodeId;
// Required methods
fn visit_cycles<F, B>(&self, visitor: F) -> Option<B>
where F: FnMut(&Self, &[Self::NodeId]) -> ControlFlow<B>;
fn cycles(&self) -> Vec<Vec<Self::NodeId>>;
// Provided method
fn visit_all_cycles<F>(&self, visitor: F)
where F: FnMut(&Self, &[Self::NodeId]) { ... }
}
Expand description
Trait for identifying cycles in a graph The node identifier of the underlying graph
Required Associated Types§
Required Methods§
Sourcefn visit_cycles<F, B>(&self, visitor: F) -> Option<B>
fn visit_cycles<F, B>(&self, visitor: F) -> Option<B>
Apply the visitor
to each cycle until we are told to stop
The first argument passed to the visitor is a reference to the
graph and the second one a slice with all nodes that form the
cycle. If at any point the visitor returns
ControlFlow::Break(b)
this function stops visiting any
further cycles and returns Some(b)
. Otherwise the return
value is None
.
Provided Methods§
Sourcefn visit_all_cycles<F>(&self, visitor: F)
fn visit_all_cycles<F>(&self, visitor: F)
Apply the visitor
to each cycle until we are told to stop
The first argument passed to the visitor is a reference to the graph and the second one a slice with all nodes that form the cycle.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.