That only works well if each "variant" holds the same kind of thing. If not, you have to store them one after the other (space wastage), or use interfaces to store them in the same place (tag isn't necessary anymore, extra boxing).
Rust enums (ADTs) aren't like Java enums where each variant contains the same kind of data.
Rust enums (ADTs) aren't like Java enums where each variant contains the same kind of data.