Why does an enum require extra memory size?

In Rust, unlike in C, enums are tagged unions. That is, the enum knows which value it holds. So 8 bytes wouldn’t be enough because there would be no room for the tag.

Leave a Comment