From 880d779e6c98bc8962be69896d31f3a48be5c7f3 Mon Sep 17 00:00:00 2001 From: lilymonade Date: Tue, 11 Mar 2025 18:57:14 +0100 Subject: [PATCH] big flemme faire une pr pour ca --- subject_text/errors/result.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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/).