Let's say we have a nested struct, similar to nested example, but it has two inner variants that depend on the Variant. All using the same names for variants:
This works but gets complicated quickly. I'd like to propose adding a same_variants attribute or something similar, which allows writing the above code as follows:
Combining this with only(...) would make writing such nested structs easier (and more readable), especially if there are a lot of different variants.
The alternative of using the Inner enum normally (i.e. the enum inside of Outer is sometimes not an option either, as the nested example already demonstrates.
Let's say we have a nested struct, similar to nested example, but it has two inner variants that depend on the Variant. All using the same names for variants:
This works but gets complicated quickly. I'd like to propose adding a
same_variants
attribute or something similar, which allows writing the above code as follows:Combining this with
only(...)
would make writing such nested structs easier (and more readable), especially if there are a lot of different variants.The alternative of using the
Inner
enum normally (i.e. the enum inside ofOuter
is sometimes not an option either, as the nested example already demonstrates.