macro_rules! assert_matches { ($expression:expr, $pattern:pat if $guard:expr $(,)?) => { ... }; ($expression:expr, $pattern:pat) => { ... }; ($expression:expr, $pattern:pat if $guard:expr, $($message:tt)+) => { ... }; ($expression:expr, $pattern:pat, $($message:tt)+) => { ... }; }
Expand description
Assert expression 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 = 'a';
assert_matches!(a, 'a'..='z');
// This will panic
let a = 'a';
assert_matches!(a, 'b'..='z');
// assertion failed: `assert_matches!(a)`
// https://docs.rs/assertables/8.18.0/assertables/macro.assert_matches.html
// args: `a, 'b'..='z'`