diff --git a/subject_text/errors/result.md b/subject_text/errors/result.md index f1769d4..8d0e38f 100644 --- a/subject_text/errors/result.md +++ b/subject_text/errors/result.md @@ -6,7 +6,7 @@ file = "src/errors/result.rs" We saw earlier the `Option` type, which represents a possibly absent value (sometimes called "nullable" in other languages). Now it would be useful to carry **the reason** of this absence of value. Let's say you are parsing an integer from a `String`, there are multiple ways it can fail. - The string contains invalid characters (non-digits). -- The value we want to parse is too large (for example, trying to parse `"999999999999"` as an i32). +- The value we want to parse is too large (for example, trying to parse `"999999999999"` as an `i32`). If we want to react properly, we need to know why it failed. So instead of having only `None` as output, we would like a variant like `SomeError(v)`. In Rust, this type with `Some` and `SomeError` variants is called [`Result`](https://doc.rust-lang.org/std/result/).