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 18

Parse a config line with ?

opt-parse-01Related book chapters: 2 (optional — this page is complete on its own)FromStrResult

Slug: opt-parse-01 · Paired reading: Chapter 2

Prompt

Config lines look like key=value where value is an i32. fn parse_line(line: &str) -> Result<(String, i32), &'static str> — split once on =, parse the value with ?-friendly conversion (map_err to static str). Reject missing =.