1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-23 15:14:35 +02:00
Nicole L 9023dd9caa
Tweak timings of exercises to better reflect teaching times (#1839)
A few of the early exercises had much larger estimates than were
actually necessary for the super simple early exercises. I've gone
through and reviewed the time estimates for exercises and tweaked the
estimates based on how much time students have actually needed in my
classes so far.
2024-02-22 10:21:39 -05:00

602 B

minutes
30

Exercise: Rewriting with Result

The following implements a very simple parser for an expression language. However, it handles errors by panicking. Rewrite it to instead use idiomatic error handling and propagate errors to a return from main. Feel free to use thiserror and anyhow.

HINT: start by fixing error handling in the parse function. Once that is working correctly, update Tokenizer to implement Iterator<Item=Result<Token, TokenizerError>> and handle that in the parser.

{{#include exercise.rs:types}}

{{#include exercise.rs:panics}}