Download next.js/turbopack/crates/turbo-tasks/src/graph/control_flow.rs from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/crates/turbo-tasks/src/graph/control_flow.rs
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/turbopack/crates/turbo-tasks/src/graph/control_flow.rs
-
curl -L -o control_flow.rs https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/crates/turbo-tasks/src/graph/control_flow.rs
1.38 kB
| /// The control flow of visiting an edge during a graph traversal. | |
| pub enum VisitControlFlow<Node, Abort = !> { | |
| /// The traversal should continue on the outgoing edges of the given node. | |
| Continue(Node), | |
| /// The traversal should skip visiting the edges the given node. | |
| Skip(Node), | |
| /// The traversal should abort and return immediately. | |
| Abort(Abort), | |
| } | |
| impl<Node, Abort> VisitControlFlow<Node, Abort> { | |
| /// Map the continue and skip values of this control flow. | |
| pub fn map_node<Map, Mapped>(self, mut map: Map) -> VisitControlFlow<Mapped, Abort> | |
| where | |
| Map: FnMut(Node) -> Mapped, | |
| { | |
| match self { | |
| VisitControlFlow::Continue(node) => VisitControlFlow::Continue(map(node)), | |
| VisitControlFlow::Skip(node) => VisitControlFlow::Skip(map(node)), | |
| VisitControlFlow::Abort(abort) => VisitControlFlow::Abort(abort), | |
| } | |
| } | |
| /// Map the abort value of this control flow. | |
| pub fn map_abort<Map, Mapped>(self, mut map: Map) -> VisitControlFlow<Node, Mapped> | |
| where | |
| Map: FnMut(Abort) -> Mapped, | |
| { | |
| match self { | |
| VisitControlFlow::Continue(node) => VisitControlFlow::Continue(node), | |
| VisitControlFlow::Skip(node) => VisitControlFlow::Skip(node), | |
| VisitControlFlow::Abort(abort) => VisitControlFlow::Abort(map(abort)), | |
| } | |
| } | |
| } | |