Skip to content

Commit fdec5ea

Browse files
igor-petrukqwandor
authored andcommitted
Update result.md (google#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>
1 parent e0355cd commit fdec5ea

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/error-handling/result.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,13 @@ fn main() {
2121
}
2222
}
2323
```
24+
25+
<details>
26+
27+
* As with `Option`, the successful value sits inside of `Result`, forcing the developer to
28+
explicitly extract it. This encourages error checking. In the case where an error should never happen,
29+
`unwrap()` or `expect()` can be called, and this is a signal of the developer intent too.
30+
* `Result` documentation is a recommended read. Not during the course, but it is worth mentioning.
31+
It contains a lot of convenience methods and functions that help functional-style programming.
32+
33+
</details>

0 commit comments

Comments
 (0)