pub trait Colored: Sized {
// Required methods
fn color(&self) -> u32;
fn from_color(color: u32) -> Option<Self>;
// Provided methods
fn color_string(&self) -> String { ... }
fn from_color_str<S: AsRef<str>>(color: S) -> Option<Self> { ... }
}
Expand description
Definitions which are associated with colors.
Required Methods§
Sourcefn from_color(color: u32) -> Option<Self>
fn from_color(color: u32) -> Option<Self>
Attempts to convert a hexadecimal color.
Provided Methods§
Sourcefn color_string(&self) -> String
fn color_string(&self) -> String
Converts this into a hexademical color string in the format “#FFFFFF”.
Sourcefn from_color_str<S: AsRef<str>>(color: S) -> Option<Self>
fn from_color_str<S: AsRef<str>>(color: S) -> Option<Self>
Attempts to convert a hexadecimal color string.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.