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:
parent
10bd1616cb
commit
543cad59e4
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user