Rust enums always have a discriminant: https://doc.rust-lang.org/std/mem/fn.discriminant.html
Their representation in memory may not use it, but it's still defined.
Re:Using enums to represent state in Rust
by 0x457 on Friday September 22, 2023 @02:37PM
(#37615902)
They do, but IIRC this mostly to compare enum variants when it can't implement `Eq` and/or `PartialEq`. For example, in tests.
There are also zero variants enums that don't have any discriminant, but still could be used.
I'm not sure what's the point of comparing it to C because enums in C only carry tags and no data, while unions only carry data and no tag. Enums in rust could do both.
Also, Rust does have actual tagged unions for C interop that you have to define yourself as a `struct` with an int field and a `union` field, just like in C.