I\'m using an enum for polymorphism, similar to the following:
enum MyType {
Variant1 { a: i32, b: i32 },
Variant2 { a: bool, b: bool },
}
There have been multiple RFCs about making enum variants their own type:
Unfortunately, they have been postponed or not yet decided on as this is not considered a language priority.
This means that right now, the way you have proposed is the only way to have types for enum variants.