Expand description

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

Macros

break if input is false

break false if input is false

break false if input is Option::None

break false if input is Result::Err

break false if input is true

break None if input is false

break None if input is Option::None

break None if input is Result::Err

break None if input is true

break if input is Option::None

break if input is Result::Err

break if input is true

break true if input is false

break true if input is Option::None

break true if input is Result::Err

break true if input is true

continue if input is false

continue if input is Option::None

continue if input is Result::Err

continue if input is true

return if input is false

return false if input is false

return false if input is Option::None

return false if input is Result::Err

return false if input is true

return None if input is false

return None if input is Option::None

return None if input is Result::Err

return None if input is true

return if input is Option::None

return if input is Result::Err

return if input is true

return true if input is false

return true if input is Option::None

return true if input is Result::Err

return true if input is true