Would this only apply to the top-level scrutinee? I see matching on Option
s of enums relatively commonly, so would you also be able to write
match Some(Foo::Bar) {
Some(Bar) => {}
Some(Baz) => {}
Some(Quux) => {}
None => {}
}
It would also be useful to be able to do the same thing for manual struct+associated const enums as well, you can't even currently use
them to bring the consts into scope (though that is likely much more controversial)
#[derive(PartialEq, Eq)]
struct Foo(u8);
impl Foo {
const BAR: Self = Self(0);
const BAZ: Self = Self(1);
const QUUX: Self = Self(2);
}
match Foo::BAR {
BAR => {}
BAZ => {}
QUUX => {}
_ => {}
}