3 ms·
Enums have 3 different variant types: enum Foo { StructVariant { named: i32, fields: String, with: (), types: usize }, TupleVariant(i32, St
by estebank 6y ago
Enums have 3 different variant types:
enum Foo {
StructVariant { named: i32, fields: String, with: (), types: usize },
TupleVariant(i32, String, usize), // only types and position information
UnitVariant, // just a tag, no other days being carried
}
The struct variant is useful when you are carrying enough different fields that you want to name them.