1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! A shim library for a stable implementation of what is proposed in [RFC 2046](https://rust-lang.github.io/rfcs/2046-label-break-value.html),
//! 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](https://rust-lang.github.io/rfcs/2046-label-break-value.html#motivation)
//! with only minor modifications:
//!
//! ```rust
//! use breakable_block::breakable;
//!
//! # fn do_thing() {}
//! # fn do_next_thing() {}
//! # fn do_last_thing() {}
//! # fn condition_not_met() -> bool { true }
//! breakable!('block: {
//! do_thing();
//! if condition_not_met() {
//! break 'block;
//! }
//! do_next_thing();
//! if condition_not_met() {
//! break 'block;
//! }
//! do_last_thing();
//! });
//! ```
// No std dependency
/// A breakable block, similar to [RFC 2046](https://rust-lang.github.io/rfcs/2046-label-break-value.html).
///
/// See the crate-level documentation for more information.