Crates.io | breakable-block |
lib.rs | breakable-block |
version | 1.0.0 |
source | src |
created_at | 2021-11-06 21:16:05.750299 |
updated_at | 2021-11-06 21:16:05.750299 |
description | A shim library for a stable implementation of what is proposed in RFC 2046. |
homepage | https://github.com/zedseven/breakable-block |
repository | https://github.com/zedseven/breakable-block |
max_upload_size | |
id | 477843 |
size | 19,192 |
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.
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();
});
The only difference in syntax from the example in the RFC is the wrapping macro call.
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in breakable-block by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.