From e3c8c457ba8744b0f1b799c4d7d4bf24e8e61792 Mon Sep 17 00:00:00 2001 From: mo8it Date: Tue, 2 Jul 2024 01:03:55 +0200 Subject: from_str solution --- rustlings-macros/info.toml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'rustlings-macros/info.toml') diff --git a/rustlings-macros/info.toml b/rustlings-macros/info.toml index b848e0e..4ef1a0a 100644 --- a/rustlings-macros/info.toml +++ b/rustlings-macros/info.toml @@ -1183,13 +1183,11 @@ hint = """ The implementation of `FromStr` should return an `Ok` with a `Person` object, or an `Err` with an error if the string is not valid. -This is almost like the `from_into` exercise, but returning errors instead -of falling back to a default value. +This is almost like the previous `from_into` exercise, but returning errors +instead of falling back to a default value. -Look at the test cases to see which error variants to return. - -Another hint: You can use the `map_err` method of `Result` with a function -or a closure to wrap the error from `parse::`. +Another hint: You can use the `map_err` method of `Result` with a function or a +closure to wrap the error from `parse::`. Yet another hint: If you would like to propagate errors by using the `?` operator in your solution, you might want to look at -- cgit v1.2.3