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

Add speaker notes for option-result.md

This commit is contained in:
Fabian Bornhofen 2023-01-11 14:19:21 +01:00
parent dd194f07c9
commit 02e1f4b879

View File

@ -12,3 +12,14 @@ fn main() {
println!("idx: {idx:?}");
}
```
<details>
* `Option` and `Result` are widely used not just in the standard library.
* `Option<&T>` has zero space overhead compared to `&T`.
* `Result` is the standard type to implement error handling as we will see on Day 3.
* `binary_search` returns `Result<usize, usize`.
* If found, `Result::Ok` holds the index where the element is found.
* Otherwise, `Result::Err` contains the index where such an element should be inserted.
</details>