1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-04 03:25:08 +02:00

Update result.md (#250)

* Update result.md

Adding a speaker note that `Result` documentation is a recommended read.

* Adding a note why `Result` encourages error checking.

* Wordsmithing

Co-authored-by: Andrew Walbran <qwandor@google.com>
This commit is contained in:
Igor Petruk 2023-01-23 13:47:41 +00:00 committed by GitHub
parent 10bd1616cb
commit 543cad59e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,3 +21,13 @@ fn main() {
}
}
```
<details>
* As with `Option`, the successful value sits inside of `Result`, forcing the developer to
explicitly extract it. This encourages error checking. In the case where an error should never happen,
`unwrap()` or `expect()` can be called, and this is a signal of the developer intent too.
* `Result` documentation is a recommended read. Not during the course, but it is worth mentioning.
It contains a lot of convenience methods and functions that help functional-style programming.
</details>