pub trait ToRgba: Copy {
// Required method
fn to_rgba(self) -> RGBA;
}Expand description
Trait for types that can be converted to RGBA losslessly.
This is the primary conversion trait in the color system. Any type
implementing ToRgba can be used as a color argument anywhere in
the engine:
use optic_color::*;
fn set_color(c: impl ToRgba) {
let rgba = c.to_rgba();
// ...
}
set_color(RED);
set_color(HSV::new(200.0, 0.8, 0.9));Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".