Struct twitch_message::Color
source · Expand description
A RGB color triplet
Examples
Parsing:
let color: Color = "#ff00ff".parse()?;
assert_eq!(color, Color(0xFF, 0x00, 0xFF));
let color: Color = "abcdef".parse()?;
assert_eq!(color, Color(0xAB, 0xCD, 0xEF));
let color: Color = Color::from_str("123456")?;
assert_eq!(color, Color(0x12, 0x34, 0x56));
Formatting:
let color = Color(0xDF, 0x12, 0x34);
assert_eq!(color.to_string(), "#DF1234")
Tuple Fields§
§0: u8
Red
1: u8
Green
2: u8
Blue
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Color
impl Ord for Color
source§impl PartialEq<Color> for Color
impl PartialEq<Color> for Color
source§impl PartialOrd<Color> for Color
impl PartialOrd<Color> for Color
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more