I am trying to see if I can create an enum, whereby I have an enum, with 3 variants, where the last one is a struct that has a field which can be one of the other two enum variants. I.e.
enum A {
A1,
A2,
A3 {
field: A // This can be either A1 or A2
}
}
When doing this I get the error saying that A has infinite size, however I was wondering if there was a way to say that although the field must be a variant, it can only be of type A1 or A2, which wouldnt result in an infinite size?
Thanks
Karl