In Rust, enums are composite data types that can have multiple variants. In this article, we show you how to define, instantiate, and use them. We also cover pattern matching and two common enums for error handling: Option and Result.
With Rust generics, programmers can write general algorithms that work with arbitrary types, reducing code duplication and providing type safety. In this article, we show when and how to use them.
In Rust, structs are composite data types that contain multiple related types. In this article, we show you how to define and instantiate structs, derive traits for them, and create struct methods.