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.
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
Slug: opt-result-01 · Paired reading: Chapters 2 and 8
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.