pub struct Color {
pub guid: Uuid,
pub name: String,
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}
Expand description
A color with RGBA values and JSON serialization support.
Fields§
§guid: Uuid
§name: String
§r: u8
§g: u8
§b: u8
§a: u8
Implementations§
Source§impl Color
impl Color
Sourcepub fn to_float_array(&self) -> [f32; 4]
pub fn to_float_array(&self) -> [f32; 4]
Convert to float array [0-1].
Sourcepub fn to_json_data(&self) -> Result<String, Box<dyn Error>>
pub fn to_json_data(&self) -> Result<String, Box<dyn Error>>
Serialize to JSON string (for cross-language compatibility)
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
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more