macro_rules! debug_assert_matches {
    ($expression:expr, $($pattern:tt)+) => { ... };
}
Expand description

Assert that an expression matches a refutable pattern using debug assertions.

Syntax: debug_assert_matches!( expression , pattern )

If debug assertions are enabled, panic with a message that shows the expression if it does not match the pattern.

When debug assertions are not enabled, this macro does nothing.

Examples

#[macro_use]
extern crate matches;

fn main() {
    let data = [1, 2, 3];
    debug_assert_matches!(data.get(1), Some(_));
}