fix(try_from_into): Hint at &str to Box<dyn std::error:Error> conversion.

This commit is contained in:
LeoniePhiline 2021-08-09 03:26:37 +02:00
parent df25684cb7
commit 7038eb8c61

View File

@ -19,9 +19,14 @@ struct Color {
// You need to create an implementation for a tuple of three integers,
// an array of three integers and a slice of integers.
//
// Note that the implementation for tuple and array will be checked at compile time,
// Note that correct RGB color values must be integers in the 0..=255 range.
//
// Also note that the implementation for tuple and array will be checked at compile time,
// but the slice implementation needs to check the slice length!
// Also note that correct RGB color values must be integers in the 0..=255 range.
// A little hint:
// `Box<dyn Error>` implements the `From` trait over `&str`.
// This means you can call `"...".into()` to convert
// and box your custom error to return as `Result::Err`.
// Tuple implementation
impl TryFrom<(i16, i16, i16)> for Color {