Slug: opt-result-02 · Paired reading: Chapters 2 and 8
Prompt
fn describe(r: Result<i32, &str>) -> String — match exhaustively:
Ok(n) → "ok:{n}", Err(e) → "err:{e}". No 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 14
Slug: opt-result-02 · Paired reading: Chapters 2 and 8
fn describe(r: Result<i32, &str>) -> String — match exhaustively:
Ok(n) → "ok:{n}", Err(e) → "err:{e}". No unwrap.