Macro match_one

Source
macro_rules! match_one {
    ($name:ident,$($variant:ident : $matcher:ty),*) => { ... };
}
Expand description

A helper macro for matching one of the variants. The macro will generate an enum with the given name and variants. The enum will implement the FromEvent trait, and will try to match the event with the given matchers.

ยงExample

match_one!(MatchOne, A: AMatcher, B: BMatcher);

The above code will generate an enum like this:

pub enum MatchOne {
   A(AMatcher),
   B(BMatcher),
}