Struct net_ensembles::sampling::ColorRGB [−][src]
Expand description
RGB value
- stores a color in RGB space
- default color is black
[0,0,0]
Fields
red: u8
The red part
green: u8
The green part
blue: u8
The blue part
Implementations
Create color from an array
color[0]
-> redcolor[1]
-> greencolor[2]
-> blue
Turn into hex representation
use sampling::heatmap::ColorRGB;
let color = ColorRGB::new(0,0,0);
let hex = color.to_hex();
assert_eq!(&hex, "#000000");
let color = ColorRGB::new_from_array(&[255,255,255]);
let hex = color.to_hex();
assert_eq!(&hex, "#FFFFFF");
Write hex representation to a fmt writer
- similar to
to_hex
, but writes to fmt writer instead
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<ColorRGB, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<ColorRGB, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for ColorRGB
impl UnwindSafe for ColorRGB
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more