macro_rules! assert_some { ($a:expr $(,)?) => { ... }; ($a:expr, $($message:tt)+) => { ... }; }
Expand description
Assert expression is Some(_).
Pseudocode:
a is Some(_)
-
If true, return
(). -
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/8.18.0/assertables/macro.assert_some.html
// option label: `a`,
// option debug: `None`