assert_matches

Macro assert_matches 

Source
macro_rules! assert_matches {
    ($expression:expr => $pattern:pat) => { ... };
}
Expand description

Assert that an expression matches a refutable pattern.

Syntax: assert_matches!( expression => pattern )

Panic with a message that shows the expression if it does not match the pattern.

ยงExamples

#[macro_use]
extern crate acick_util;

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