Use ops::ControlFlow in graph::iterate
This commit is contained in:
parent
0d0f6b1130
commit
fac272688e
7 changed files with 19 additions and 13 deletions
|
@ -87,11 +87,8 @@ where
|
|||
}
|
||||
|
||||
/// Allows searches to terminate early with a value.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum ControlFlow<T> {
|
||||
Break(T),
|
||||
Continue,
|
||||
}
|
||||
// FIXME (#75744): remove the alias once the generics are in a better order and `C=()`.
|
||||
pub type ControlFlow<T> = std::ops::ControlFlow<(), T>;
|
||||
|
||||
/// The status of a node in the depth-first search.
|
||||
///
|
||||
|
@ -260,12 +257,12 @@ where
|
|||
_node: G::Node,
|
||||
_prior_status: Option<NodeStatus>,
|
||||
) -> ControlFlow<Self::BreakVal> {
|
||||
ControlFlow::Continue
|
||||
ControlFlow::CONTINUE
|
||||
}
|
||||
|
||||
/// Called after all nodes reachable from this one have been examined.
|
||||
fn node_settled(&mut self, _node: G::Node) -> ControlFlow<Self::BreakVal> {
|
||||
ControlFlow::Continue
|
||||
ControlFlow::CONTINUE
|
||||
}
|
||||
|
||||
/// Behave as if no edges exist from `source` to `target`.
|
||||
|
@ -290,7 +287,7 @@ where
|
|||
) -> ControlFlow<Self::BreakVal> {
|
||||
match prior_status {
|
||||
Some(NodeStatus::Visited) => ControlFlow::Break(()),
|
||||
_ => ControlFlow::Continue,
|
||||
_ => ControlFlow::CONTINUE,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(control_flow_enum)]
|
||||
#![feature(in_band_lifetimes)]
|
||||
#![feature(unboxed_closures)]
|
||||
#![feature(generators)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue