The type of the value returned on Break (early exit).
The type of the value returned on Continue (default: void).
Readonly[A unique symbol property used to identify the variant of this ControlFlow.
Returns 'Break' if the ControlFlow signals early exit, or 'Continue' if it signals to proceed as normal.
This is used internally by the isControlFlow utility function to verify that an object is a valid ControlFlow instance,
and to distinguish between Break and Continue variants without calling methods.
Note: The symbol itself is not exported as part of the public API.
Use the isControlFlow utility function or the isBreak()/isContinue() methods for type checking.
Readonly[toThe well-known symbol Symbol.toStringTag used by Object.prototype.toString().
Returns 'ControlFlow' so that Object.prototype.toString.call(flow) produces '[object ControlFlow]'.
This enables reliable type identification even across different execution contexts (e.g., iframes, different module instances).
Extracts the value from a ControlFlow<T, T> where both type parameters are the same.
This method is only available when B and C are the same type.
It returns the contained value regardless of whether this is a Break or Continue.
The contained value.
Maps ControlFlow<B, C> to ControlFlow<T, C> by applying a function
to the break value in case it exists.
The type of the new break value.
A new ControlFlow with the mapped break value.
Maps ControlFlow<B, C> to ControlFlow<B, T> by applying a function
to the continue value in case it exists.
The type of the new continue value.
A new ControlFlow with the mapped continue value.
Used to tell an operation whether it should exit early or go on as usual.
This is the return type of
try_foldand similar iterator methods that support short-circuiting. It can also be used in custom control flow scenarios.Use cases:
Since
1.6.0
See
https://doc.rust-lang.org/std/ops/enum.ControlFlow.html
Example
Example