#macro #results #break #bob #bail

bail_macros

为 Options、Results 等 提供 Bail 宏

1 个不稳定版本

0.1.0 2022 年 3 月 20 日

#1689 in Rust 模式

Apache-2.0

11KB
285

Bail 宏

Crates.io Lib.rs Docs.rs License

为 Options、Results 等 提供 Bail 宏

快速示例

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:

为 Options、Results 等 提供 Bail 宏

Crates.io Lib.rs Docs.rs License

示例

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!");

依赖项