diff options
| author | Taylor Yu <tlyu@mit.edu> | 2021-06-09 23:26:10 -0500 |
|---|---|---|
| committer | ana <ana@ana.st> | 2021-09-25 11:18:21 +0200 |
| commit | 882d535ba8628d5e0b37e8664b3e2f26260b2671 (patch) | |
| tree | 169284d31e043aadeedbaa6b9557fcc3dc46109f /info.toml | |
| parent | 2dc93caddad43821743e4903d89b355df58d7a49 (diff) | |
feat: add advanced_errs1
New section and exercise to demonstrate the `From` trait for errors
and its usefulness with the `?` operator.
Diffstat (limited to 'info.toml')
| -rw-r--r-- | info.toml | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -974,3 +974,23 @@ path = "exercises/conversions/as_ref_mut.rs" mode = "test" hint = """ Add AsRef<str> as a trait bound to the functions.""" + +# ADVANCED ERRORS + +[[exercises]] +name = "advanced_errs1" +path = "exercises/advanced_errors/advanced_errs1.rs" +mode = "test" +hint = """ +This exercise uses an updated version of the code in errors6. The parsing +code is now in an implementation of the `FromStr` trait. Note that the +parsing code uses `?` directly, without any calls to `map_err()`. There is +one partial implementation of the `From` trait example that you should +complete. + +Details: The `?` operator calls `From::from()` on the error type to convert +it to the error type of the return type of the surrounding function. + +Hint: You will need to write another implementation of `From` that has a +different input type. +""" |
