Hacker News new | ask | show | jobs
by sagarm 15 days ago
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.

1 comments

You missed the point as well. You can't define a union type in Rust that is backed by a custom enum type. In rust it's a single conflated type. I can't make a Person enum that is backed by a PersonKind. I don't know how else to describe this. I'm not sure how else to explain this.
Code snippet you think should compile but doesn't, or vice versa.