Slug: err-design-02 · Paired reading: Chapters 2 and 8
Prompt
Anyhow-style without the crate: fn load_port(cfg: &str) -> Result<u16, String>
parses a port and wraps failures with context via map_err
(e.g. prefix loading port: ).
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? Get it on Amazon (US and other storefronts linked in the site footer) — the Preface access code unlocks this gym.
beginner · order 41
Slug: err-design-02 · Paired reading: Chapters 2 and 8
Anyhow-style without the crate: fn load_port(cfg: &str) -> Result<u16, String>
parses a port and wraps failures with context via map_err
(e.g. prefix loading port: ).