Skip to main content

Module exits

Module exits 

Source
Expand description

Deferring early exits.

When a node runs inside a concurrent chain, its ?, return, break and continue cannot leave the function or loop from inside the chain’s future. ExitRewriter replaces each one with “record the exit in a slot, then stop this chain” (break '__psync_chainN None), and Slots::reraise performs the recorded exit after the join. Re-raising node by node in program order makes the function exit exactly where sequential code would have, with the same error value (the original ? conversion happens at the re-raise).

Structs§

ExitRewriter 🔒
Rewrites the early exits of one node to record-and-stop. Closures, async blocks and nested items keep their own exits; loops and labeled blocks inside the node keep exits aimed at them.
Slots 🔒
The exit slots of one node, declared as let mut slot = None; before its chain runs.