Ruta de aprendizaje

Structs, enums y traits

Modela datos con structs y enums, compara patrones, maneja Option y Result, y comparte comportamiento con traits y genéricos.

10 lecciones · 14 retos

  1. Lección 1 reto Structs Group related values into your own type with named fields.
  2. Lección 2 retos Methods and impl Blocks Attach functions to a struct with impl, including constructors.
  3. Lección 1 reto Enums Define a type that is one of several variants, each with its own data.
  4. Lección 2 retos Pattern Matching with match Compare a value against patterns with match, guards and if let.
  5. Lección 1 reto Temperature Converter Convert between Celsius and Fahrenheit with an enum.
  6. Lección 2 retos Option: Values That May Be Missing Represent a missing value with Option instead of null.
  7. Lección 2 retos Error Handling with Result Return errors as values with Result and pass them on with the ? operator.
  8. Lección 1 reto Bank Account with Result Model deposits and withdrawals that can fail with your own error type.
  9. Lección 1 reto Traits Describe shared behavior with a trait and implement it for different types.
  10. Lección 1 reto Generics Write one function or struct that works with many types.