breaktarget
The breaktarget
module defines one type: The BreakTarget
type. A
value of this type may be obtained by invoking BreakTarget::deploy
.
BreakTarget::deploy
takes a lambda, which is passed a reference to a
BreakTarget
. This object defines a single method, break_with
, which
takes a value of type T
and returns control flow to the site of the
BreakTarget::deploy
call, producing the value as the result. If the lambda
exits normally, it must also produce a value of type T
, which is produced
as the result of the BreakTarget::deploy
call.
Important Notes
The nonlocal breaking is implemented using a panic to unwind the stack. Any open Mutexes which are closed by this unwinding will be poisoned, among with other unwinding specific effects.
If panic = "abort"
is enabled, calls to break_with
will abort the program
Examples
use Breaktarget;
let result = deploy;
assert_eq!;
use BreakTarget;
let result1 = deploy;
assert_eq!;
let result2 = deploy;
assert_eq!;