pub trait FromStimulus<T> {
// Required method
fn from_stimulus(other: T) -> Self;
}
Expand description
Converts from a stimulus color component type, while performing the appropriate scaling, rounding and clamping.
use palette::stimulus::FromStimulus;
// Scales the value up to u8::MAX while converting.
let u8_component = u8::from_stimulus(1.0f32);
assert_eq!(u8_component, 255);
Required Methods§
Sourcefn from_stimulus(other: T) -> Self
fn from_stimulus(other: T) -> Self
Converts other
into Self
, while performing the appropriate scaling,
rounding and clamping.
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.