macro_rules! assert_some {
($a:expr $(,)?) => { ... };
($a:expr, $($message:tt)+) => { ... };
}Expand description
Assert expression is Some.
Pseudocode:
a is Some(a1)
-
If true, return
a1. -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use assertables::*;
let a: Option<i8> = Option::Some(1);
assert_some!(a);
// This will panic
let a: Option<i8> = Option::None;
assert_some!(a);
// assertion failed: `assert_some!(a)`
// https://docs.rs/assertables/…/assertables/macro.assert_some.html
// option label: `a`,
// option debug: `None`