Into impls for Colour (are these necessary?)
This commit is contained in:
parent
f323e0e841
commit
82c0f78177
|
@ -1,5 +1,7 @@
|
|||
use std::fmt;
|
||||
|
||||
use image;
|
||||
use image::Rgba;
|
||||
use serde_derive::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -37,6 +39,18 @@ impl Into<Vec<u8>> for Colour {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<image::Rgba<u8>> for Colour {
|
||||
fn into(self) -> Rgba<u8> {
|
||||
Rgba::from([self.red, self.green, self.blue, 255])
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<[u8; 4]> for Colour {
|
||||
fn into(self) -> [u8; 4] {
|
||||
[self.red, self.green, self.blue, 255]
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::Colour;
|
||||
|
|
Loading…
Reference in New Issue