I have several enums:
enum Foo {
A(A),
B(B)
}
enum A {
C(i32),
D(i32)
}
enum B {
E(i32),
F(i32)
}
How could I write a function that takes a Foo
and checks if it is, say, a B::E
, then returns an Option<Foo>
?
Edit: for clarification, the enum value is passed as an argument. I tried doing it with a signature of f(value: Foo, expected: Foo)
but I'm not sure how to call that, as (with B::E
again) the compiler wants an i32 supplied.