#[repr(u32)]
#[derive(PartialOrd, Ord, PartialEq, Eq)]
enum A {
One = 1,
Two = 2,
Three = 3
}
fn main() {
let x = A::One;
match x {
A::One...A::Two => println!("One or Two"),
_ => println!("The rest")
}
}
The real enum is much bigger and I don't want to OR them all.
Currently I solve this by using
Thanks for the solution but I think you missed my point. It's the cleaner syntax I want. Your way is basically same (if not worse ) as x if x => A::One && x <= A::Two => ....