I have an enum:
enum MyEnum {
A(i32),
B(i32),
C,
D,
// ...
}
Can I match on A and B simultaneously with something like this:
let a = MyEnum::A(1);
match a {
_(n) => { // do something for all variants which have one i32 value
}
_ => { // ignore the rest
}
};
Is there any way to accomplish this? Do I have to match all the variants and apply the same "body" for each?