Is there a way to use existing structs as enum variants?

There have been multiple RFCs about making enum variants their own type:

  • RFC 1450: Types for enum variants
  • RFC 2593: Enum variant types

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.


No, that's exactly how that works.