Get Started with Rust: Enums
Get Started with Rust: Enums There are two ways to create custom data types in Rust: structs and enums. In contrast to structs, enums construct a type that has multiple variants and not multiple fields. While structs are a part of pretty much any programming language, enums are not so mainstream and are mostly seen in statically typed functional languages like Haskell or OCaml. But, as we’ll see, they are quite nice for domain modeling with types. This […]