-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use trait objects for try_from_into
Use `Box<dyn error::Error>` to allow solutions to use `?` to propagate errors. In the tests, explicitly check `is_ok()` instead of trying to force the error type to `String` (or other `PartialEq` type) using `assert_eq!()`.
- Loading branch information
Showing
1 changed file
with
22 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2e93a58
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
I am a rust beginner and I am using Rustlings to get familiarized with the Rust. I am having trouble with understanding the expectations of the try_from_into exercise after this change.
Returning a String wrapped in Err
does not seems to work as the String does not have the error::Error trait implemented, so are we expected to implement the error::Error trait for Color and return a wrapped Color instance in Err?
Apologies if there is a simpler and easy way than this.
Regards