pub enum Foo {
A(i32),
B(String)
}
Foo x;
let Foo::A(y) = x; // does not compile
let y = match x {
Foo::A(y) => y,
_ => panic!(),
};
Is there a concise way to say: match this arm of the enum ... or panic ?
Context: parsing some json / yaml / tree like "untyped" data into Rust structs; so I know before hand "in a valid file, we must take arm A here".