Macro assertables::assert_option_none
source · macro_rules! assert_option_none { ($option:expr $(,)?) => { ... }; ($option:expr, $($message:tt)+) => { ... }; }
Expand description
Assert expression.is_none() is true.
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
let a: Option<i8> = Option::None;
assert_option_none!(a);
let a: Option<i8> = Option::Some(1);
assert_option_none!(a);
// assertion failed: `assert_option_none!(option)`
// option label: `a`,
// option debug: `Some(1)`,
// option.is_none(): `false`