macro_rules! x11_or_wayland {
    (match $what:expr; $enum:ident ( $($c1:tt)* ) => $x:expr; as $enum2:ident ) => { ... };
    (match $what:expr; $enum:ident ( $($c1:tt)* ) => $x:expr) => { ... };
}
Expand description

x11_or_wayland!(match expr; Enum(foo) => foo.something()) expands to the equivalent of

match self {
   Enum::X(foo) => foo.something(),
   Enum::Wayland(foo) => foo.something(),
}

The result can be converted to another enum by adding ; as AnotherEnum