Is there a position for @ operator or some other solution that would bind the variable in a match arm to a variant type rather than to the entire enum? In the following example, all bar, baz and qux have types of Foo, rather than Foo::Bar, Foo::Baz, Foo::Qux and the sample fails to compile.
enum Foo {
Bar(i32),
Baz{s: String},
Qux,
}
fn main() {
let foo = Foo::Bar(42);
match foo {
bar @ Bar(..) => bar.0.to_string(),
baz @ Baz{..} => baz.s,
qux @ Qux => "".to_owned(),
}
}