diff options
| author | Zerotask <Zerotask@users.noreply.github.com> | 2021-04-23 19:54:31 +0200 |
|---|---|---|
| committer | Zerotask <Zerotask@users.noreply.github.com> | 2021-04-23 19:54:31 +0200 |
| commit | 249ad44cc03974fd34708c23d9832b1729c6e844 (patch) | |
| tree | db25c5f51d76d10bc129dbcc8df2c56c75b13f2b /exercises/option/README.md | |
| parent | 54804e344d84bb620447b7975a5b8ec4f9de2671 (diff) | |
docs(exercises): updated all exercises readme files
all exercises readme files now have a unified structure and a description
Diffstat (limited to 'exercises/option/README.md')
| -rw-r--r-- | exercises/option/README.md | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/exercises/option/README.md b/exercises/option/README.md index d17b79c..a304bb4 100644 --- a/exercises/option/README.md +++ b/exercises/option/README.md @@ -1,8 +1,17 @@ -### Option +# Option -#### Book Sections +Type Option represents an optional value: every Option is either Some and contains a value, or None, and does not. +Option types are very common in Rust code, as they have a number of uses: +- Initial values +- Return values for functions that are not defined over their entire input range (partial functions) +- Return value for otherwise reporting simple errors, where None is returned on error +- Optional struct fields +- Struct fields that can be loaned or "taken" +- Optional function arguments +- Nullable pointers +- Swapping things out of difficult situations -To learn about Option<T>, check out these links: +## Further Information - [Option Enum Format](https://doc.rust-lang.org/stable/book/ch10-01-syntax.html#in-enum-definitions) - [Option Module Documentation](https://doc.rust-lang.org/std/option/) |
