File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change 2
2
// Additionally, upon implementing FromStr, you can use the `parse` method
3
3
// on strings to generate an object of the implementor type.
4
4
// You can read more about it at https://doc.rust-lang.org/std/str/trait.FromStr.html
5
+ use std:: error;
5
6
use std:: str:: FromStr ;
6
7
7
8
#[ derive( Debug ) ]
@@ -23,7 +24,7 @@ struct Person {
23
24
// If everything goes well, then return a Result of a Person object
24
25
25
26
impl FromStr for Person {
26
- type Err = String ;
27
+ type Err = Box < dyn error :: Error > ;
27
28
fn from_str ( s : & str ) -> Result < Person , Self :: Err > {
28
29
}
29
30
}
Original file line number Diff line number Diff line change @@ -884,5 +884,5 @@ path = "exercises/conversions/from_str.rs"
884
884
mode = " test"
885
885
hint = """
886
886
The implementation of FromStr should return an Ok with a Person object,
887
- or an Err with a string if the string is not valid.
887
+ or an Err with an error if the string is not valid.
888
888
This is almost like the `try_from_into` exercise."""
You can’t perform that action at this time.
0 commit comments