1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-07-06 06:27:53 +02:00

Add links to std and docs.rs (#2403)

- **Link to relevant crate APIs**
- **Add missing std links**
This commit is contained in:
Martin Geisler
2024-10-15 08:12:25 +02:00
committed by GitHub
parent 25a2fa6a09
commit cf7359fac8
3 changed files with 17 additions and 7 deletions

View File

@ -4,13 +4,16 @@ minutes: 5
# `anyhow`
The [`anyhow`](https://docs.rs/anyhow/) crate provides a rich error type with
support for carrying additional contextual information, which can be used to
provide a semantic trace of what the program was doing leading up to the error.
The [`anyhow`] crate provides a rich error type with support for carrying
additional contextual information, which can be used to provide a semantic trace
of what the program was doing leading up to the error.
This can be combined with the convenience macros from `thiserror` to avoid
This can be combined with the convenience macros from [`thiserror`] to avoid
writing out trait impls explicitly for custom error types.
[`anyhow`]: https://docs.rs/anyhow/
[`thiserror`]: https://docs.rs/thiserror/
```rust,editable,compile_fail
use anyhow::{bail, Context, Result};
use std::fs;

View File

@ -7,7 +7,10 @@ minutes: 30
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`.
[`thiserror`] and [`anyhow`].
[`thiserror`]: https://docs.rs/thiserror
[`anyhow`]: https://docs.rs/anyhow
HINT: start by fixing error handling in the `parse` function. Once that is
working correctly, update `Tokenizer` to implement