In Learning Rust With Entirely Too Many Linked Lists, the author mentions:
However, if we have a special kind of enum: enum Foo {
However, if we have a special kind of enum:
enum Foo {
enum is a tagged union. Without optimization it looks like
enum
Foo::A; // tag 0x00 data 0xXX Foo::B(2); // tag 0x01 data 0x02
The null pointer optimization removes the separate tag field.
Foo::A; // tag+data 0x00 Foo::B(2); // tag+data 0x02