1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-24 08:32:57 +02:00

Update error-contexts.md (#251)

* Update error-contexts.md

Adding more speaker notes about `anyhow`.

* Add markup

Co-authored-by: Martin Geisler <martin@geisler.net>
This commit is contained in:
Igor Petruk 2023-01-24 07:33:03 +00:00 committed by GitHub
parent 912f592199
commit 617f4e2bb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,3 +36,12 @@ fn main() {
}
}
```
<details>
* `anyhow::Result<T>` is generic and it can hold any `Error` implementation without changing the type signature.
* Actual error type inside of it can be extracted for examination if necessary.
* Functionality provided by `anyhow::Result<T>` may be familiar to Go developers, as it provides similar usage patterns and ergonomics
of `(T, error)` from Go.
</details>