Macro matches::debug_assert_matches [] [src]

macro_rules! debug_assert_matches {
    ($($arg:tt)*) => { ... };

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.


extern crate matches;

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