matcher

Macro matcher 

Source
macro_rules! matcher {
    () => { ... };
    ($(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => { ... };
}
Expand description

Creates a Matcher function from a given pattern

The syntax is similar to the std::matches macro. Calling matcher with no arguments will match anything.

ยงExamples

#[macro_use]
extern crate graphfind_rs;
use graphfind_rs::pattern_matching::*;



enum Person {
    Student {name: String},
    Prof {},
}

let student = matcher!(Person::Student{..});

let even = matcher!(i if i % 2 == 0);