summaryrefslogtreecommitdiff
path: root/rustlings-macros
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-06-26 18:21:19 +0200
committermo8it <mo8it@proton.me>2024-06-26 18:21:19 +0200
commit129884aff74964d13aba8309014554b5625d6e5b (patch)
tree478d4e673cd70990ec803d620f047da67c26df56 /rustlings-macros
parent720b280bc1d8230821b4e6f2466eddb43245b8ff (diff)
errors5 solution
Diffstat (limited to 'rustlings-macros')
-rw-r--r--rustlings-macros/info.toml17
1 files changed, 8 insertions, 9 deletions
diff --git a/rustlings-macros/info.toml b/rustlings-macros/info.toml
index d39044c..700c179 100644
--- a/rustlings-macros/info.toml
+++ b/rustlings-macros/info.toml
@@ -692,24 +692,23 @@ name = "errors5"
dir = "13_error_handling"
test = false
hint = """
-There are two different possible `Result` types produced within `main()`, which
-are propagated using `?` operators. How do we declare a return type from
-`main()` that allows both?
+There are two different possible `Result` types produced within the `main`
+function, which are propagated using the `?` operators. How do we declare a
+return type for the `main` function that allows both?
Under the hood, the `?` operator calls `From::from` on the error value to
-convert it to a boxed trait object, a `Box<dyn error::Error>`. This boxed trait
-object is polymorphic, and since all errors implement the `error::Error` trait,
-we can capture lots of different errors in one "Box" object.
+convert it to a boxed trait object, a `Box<dyn Error>`. This boxed trait object
+is polymorphic, and since all errors implement the `Error` trait, we can capture
+lots of different errors in one `Box` object.
-Check out this section of the book:
+Check out this section of The Book:
https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator
Read more about boxing errors:
https://doc.rust-lang.org/stable/rust-by-example/error/multiple_error_types/boxing_errors.html
Read more about using the `?` operator with boxed errors:
-https://doc.rust-lang.org/stable/rust-by-example/error/multiple_error_types/reenter_question_mark.html
-"""
+https://doc.rust-lang.org/stable/rust-by-example/error/multiple_error_types/reenter_question_mark.html"""
[[exercises]]
name = "errors6"