Back to Browse

Rustlings Error Handling: Option to Result, the ? Operator, and Parse Errors

3 views
May 1, 2026
1:05:44

Option is fine until you need to tell the caller *why* something failed - that's where Result comes in. This session works through the Rustlings error handling exercises: converting a function from returning Option to Result, using the question mark operator to propagate parse errors without manual match, and building up the intuition for when to use which. We also hit a fun borrow checker detour when trying to return a reference from a function. Solid practical coverage of the patterns you'll reach for constantly in real Rust code. ⏱ Chapters 0:00 Intro music (skip ahead) 4:02 Recap and error handling exercises setup 6:51 Converting Option to Result - the name tag function 12:36 Returning errors vs panicking 16:40 The question mark operator for parse errors 22:07 Borrow checker detour - can't return a reference to a local 25:28 Game item purchase - total_cost with Result and ? 39:00 More error handling exercises 54:00 Wrap-up #Rust #RustLang #Rustlings - Watch live: https://twitch.tv/lorduhuru

Download

0 formats

No download links available.

Rustlings Error Handling: Option to Result, the ? Operator, and Parse Errors | NatokHD