| ▲ | xeubie 3 hours ago | |||||||||||||
Yes, there is something you can do with separate types. You can name a variant without having a value of it. `discriminant` only works on an existing value, so to refer to "cats" you'd have to build a dummy `Cat`, and the result is opaque. You can't match on it, iterate over it, or create one from a byte you parsed off the wire. This is so obviously worse, I can't believe you bothered to ask. | ||||||||||||||
| ▲ | afdbcreid 2 hours ago | parent | next [-] | |||||||||||||
This is a minor advantage (but is an advantage) and when needed (rarely) you can usually workaround with a different fieldless enum and potentially a proc-macro to autogenerate it. | ||||||||||||||
| ||||||||||||||
| ▲ | sagarm an hour ago | parent | prev [-] | |||||||||||||
You design the enum. If you need kinds separate from the union itself, you have that power. The union type always implies a kind, after all, so it's a generalization of the concept. | ||||||||||||||
| ||||||||||||||