about
05/04/2022
RustBites - Enumerations
Rust Bite - Enumerations
Option<T>, Result<T,E>, custom
1.0 - Introduction
2.0 - Custom Enumerations
in the same way we define methods for
structs. That let's us acess and use their
inner values. Match statements require us to handle all of
the enum items. Sometimes we don't need to do that.
Then, we can use the if let statement to
test for a single enum item type. Here, the "=" operator is not assignment.
It is a matching operator that selects on a
single enum item type. How cool is Rust? Very cool!
3.0 - Matching
4.0 - References
Link | Description |
---|---|
the rust book | Easy to use examples, illustrated with std::fs |
rust-by-example | Easy to use examples that have sufficient detail for project coding |