Check out my switch! macro

Syntactic sugar for matching against expressions like A | B (bitwise OR). See github readme for more info. Feedback welcome!

https://github.com/camsteffen/switch-statement-rust

1 Like

Using ifs on the arms is a nice way of doing this :+1:

We'll eventually be able to just

match input {
    const { A | B } => ...,
    _ => ...,
}

once the following RFC is implemented:

https://github.com/rust-lang/rfcs/pull/2920

1 Like

Ah yes that will be nice. I suppose at that point this crate will only be useful if you have non-const expressions. Don't know how common that is.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.