News for hackers. Stuff that matters.
Re:Rust for JavaScript Developers – Pattern Matching and Enums by estebank on Sunday July 12, 2020 @02:37PM (#23813613)
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.

There are no comments on this comment yet.