Macro lib::assert_option_none

source ·
macro_rules! assert_option_none {
    ($option:expr $(,)?) => { ... };
    ($option:expr, $($message:tt)+) => { ... };
}
Expand description

Assert expression is None.

  • 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!(a)`
//  a label: `a`,
//  a debug: `Some(1)`

§Module macros