reuse existing function

This commit is contained in:
Max Bradbury 2021-05-15 23:21:48 +01:00
parent f1a0c5ce61
commit eb8fd556e4
1 changed files with 1 additions and 3 deletions

View File

@ -9,9 +9,7 @@ pub struct Colour {
impl From<&str> for Colour { impl From<&str> for Colour {
fn from(str: &str) -> Self { fn from(str: &str) -> Self {
let rgb = hex::decode(&str[str.len() - 6..]).unwrap(); Self::from(hex::decode(&str[str.len() - 6..]).unwrap())
Colour { red: rgb[0], green: rgb[1], blue: rgb[2] }
} }
} }