1 个不稳定版本
0.1.0 | 2022 年 3 月 20 日 |
---|
#1689 in Rust 模式
11KB
285 行
Bail 宏
为 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 宏
示例
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!");