Expand description
A shim library for a stable implementation of what is proposed in RFC 2046, allowing for short-circuit control flow without needing to return in a function or break in a loop.
When the RFC is stabilized, this crate will be deprecated.
If you don’t need to work on stable
, you can use
#![feature(label_break_value)]
in your crate root to enable the
functionality instead.
This crate has no dependencies.
§Example
Here’s an example, lifted straight from the RFC documentation with only minor modifications:
use breakable_block::breakable;
breakable!('block: {
do_thing();
if condition_not_met() {
break 'block;
}
do_next_thing();
if condition_not_met() {
break 'block;
}
do_last_thing();
});