#macro #results #break #bob #bail

bail_macros

Bail macros for Options, Results and more

1 unstable release

0.1.0 Mar 20, 2022

#1647 in Rust patterns

Apache-2.0

11KB
285 lines

Bail Macros

Crates.io Lib.rs Docs.rs License

Bail macros for Options, Results and more

Quick Example

use bail_macros::bob;

for i in 0..=20 {
    println!("Index: {}", i);
    bob!(None);
    panic!("bob didn't break");
}
println!("cob broke out of the loop!");

lib.rs:

Bail macros for Options, Results and more

Crates.io Lib.rs Docs.rs License

Examples

use bail_macros::bob;

for i in 0..=20 {
    println!("Index: {}", i);
    bob!(None);
    panic!("bob didn't break");
}
println!("cob broke out of the loop!");
use bail_macros::bob;

for i in 0..=20 {
    println!("Index: {}", i);
    bob!(Some(0));
    panic!("bob didn't break");
}
println!("cob broke out of the loop!");

Dependencies