Explore how Rust handles enums in memory, including the layout and discriminator usage. The article breaks down the assembly code generated to match an enum.
Enums without a specified repr are not guaranteed to be laid out any particular way. Everything the article says about the layout is contingent on the version of the compiler in use (and such subtle facts as whether any of the enum's fields have disallowed valies). This should be mentioned, because it is a common mistake to assume that the layout is predictable.
The standard term is “discriminant”, not “discriminator”.