Slug: enum-data-01 · Paired reading: Chapters 2 and 7
Prompt
Replace a bool+Option struct with
enum Job { Queued, Done, Failed(String) } and
fn is_terminal(j: &Job) -> bool (true for Done and Failed).
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 38
Slug: enum-data-01 · Paired reading: Chapters 2 and 7
Replace a bool+Option struct with
enum Job { Queued, Done, Failed(String) } and
fn is_terminal(j: &Job) -> bool (true for Done and Failed).