4 ms·
What is the reason for using different syntax for Move and TakePhoto from the Operation enum in the penultimate example? Is there a name for each of those enum
by jsf01 6y ago
What is the reason for using different syntax for Move and TakePhoto from the Operation enum in the penultimate example? Is there a name for each of those enum member types?
- estebank 6y agoEnums 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.