Antoine Barthelemy cdf82553ce
fix(simplify): eliminating struct type in TODOenum
Going back to what was initially intended by nyxton in order to simply exercise.
Using primitive types makes it much easier to understand, this way there is just destructuring nested structs and enums in match - which is already a lot.
"Nesting" struct in enum makes it unusual and somehow difficult.
2020-08-18 14:59:42 +02:00
..
2020-08-10 10:24:21 -04:00

Enums

Rust allows you to define types called "enums" which enumerate possible values. Enums are a feature in many languages, but their capabilities differ in each language. Rusts enums are most similar to algebraic data types in functional languages, such as F#, OCaml, and Haskell. Useful in combination with enums is Rust's "pattern matching" facility, which makes it easy to run different code for different values of an enumeration.

Book Sections