New Rustacean

e003: No. more. nulls.

New Rustacean

No More Nulls

Subject: Enumerated (enum) types, pattern matching, and meaningful return types.

Notes

Today’s episode discusses, in order:

  • Enumerated types, with an eye to the difference between structs and enums, and to the differences between enums in C and in Rust.
  • Pattern matching, with a focus on using them with enumerated types and some discussion about how they differ from switch blocks in C-like languages.
  • Using the Option and Result enumerated types with pattern matching to provide meaningful returns from functions safely.

Order

There is a specific order to the examples below, and it is not the automatically-alphabetized order rendered by rustdoc. Instead, you should work through in the sequence they appear in the source:

  1. RelatedishThings
  2. demonstrate_basic_enumeration
  3. demonstrate_match
  4. get_an_option
  5. demonstrate_option
  6. get_a_result
  7. demonstrate_result

Follow/Support

  • New Rustacean:
    • Twitter: @newrustacean
    • App.net: @newrustacean
    • Patreon
    • Email:
  • Chris Krycho

Next Episodes

New Rustacean

e002: Something borrowed, something… moved? @ New Rustacean

📆 2015-10-12 04:24 / 00:17:12


New Rustacean

e001: Document All the Things @ New Rustacean

📆 2015-10-03 22:04 / 00:17:06


New Rustacean

e000: Hello, world! @ New Rustacean

📆 2015-09-25 01:14 / 00:17:11