लर्निंग पाथ

Struct, Enum और Trait

struct और enum से डेटा मॉडल करें, पैटर्न मैच करें, Option और Result संभालें, और trait व generics से व्यवहार साझा करें।

10 पाठ · 14 चैलेंज

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