Let's say I have the enum:
enum Foo {
Bar {baz: Option<Buzz> },
}
struct Buzz {}
is there a way to match on whether baz
is None
or not?
How to match struct fields in Rust? doesn't seem to work because Rust interprets
match foo {
Foo::Bar { baz: Buzz } => {
},
Foo::Bar { baz: None } => {
}
}
the baz: Bar
as a rename.