Trait cosmic::cosmic_theme::palette::stimulus::FromStimulus

source ·
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§

source

fn from_stimulus(other: T) -> Self

Converts other into Self, while performing the appropriate scaling, rounding and clamping.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,