Rust theorytheory 0/50 · 0%
Error handling · easy

14. Option<T>

Rust's answer to null.

`Option<T>` is `Some(T)` or `None`, so absence is part of the type and must be handled. Combinators like map, and_then, unwrap_or and ok_or convert or default safely; `unwrap()` panics and belongs in tests or provably-safe code.

Check your understanding

  1. 1. What replaces null in Rust?

  2. 2. What does unwrap() do on None?