Enter your book access code

The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).

Don’t have the book yet? The landing page stays open — purchase unlocks this gym.

beginner · order 13

map_err into your error type

opt-result-01Related book chapters: 2, 8 (optional — this page is complete on its own)ResultFrommap_err

Slug: opt-result-01 · Paired reading: Chapters 2 and 8

Prompt

Define enum AppError { Parse } and fn parse_i32(s: &str) -> Result<i32, AppError> using map_err (or From) so parse failures become AppError::Parse — never unwrap.