Skip to main content

Convert

Trait Convert 

Source
pub trait Convert<I, O>: ConvertOnce<I, O> {
    // Required method
    fn convert(&self, input: I) -> O;
}
Expand description

Represents types that can convert a value from one type to another.

Required Methods§

Source

fn convert(&self, input: I) -> O

Convert an input value of type I to a value of type O.

The conversion may produce values outside the typical range of O.

use palette::{
    Xyz, Srgb,
    convert::Convert,
};

let matrix = Xyz::matrix_from_rgb();
let rgb = Srgb::new(0.8f32, 0.3, 0.3).into_linear();
let xyz = matrix.convert(rgb);

Implementations on Foreign Types§

Source§

impl<T, I, O> Convert<I, O> for &T
where T: Convert<I, O> + ?Sized,

Source§

fn convert(&self, input: I) -> O

Implementors§

Source§

impl<E, L, S, T> Convert<Luma<S, E>, Luma<Linear<S>, L>> for IntoLinearLut<E, L, <S as LumaStandard>::TransferFn, T>
where L: Clone, T: Lookup<E, L>, <T as LutType<L>>::Table: Sized, S: LumaStandard,

Source§

impl<E, L, S, T> Convert<Rgb<S, E>, Rgb<Linear<S>, L>> for IntoLinearLut<E, L, <S as RgbStandard>::TransferFn, T>
where L: Clone, T: Lookup<E, L>, <T as LutType<L>>::Table: Sized, S: RgbStandard,

Source§

impl<I, O> Convert<I, O> for Matrix3<I, O>
where Matrix3<I, O>: ConvertOnce<I, O> + Copy, I: ArrayCast,

Source§

impl<L, E, S, T> Convert<Luma<Linear<S>, L>, Luma<S, E>> for FromLinearLut<L, E, <S as LumaStandard>::TransferFn, T>

Source§

impl<L, E, S, T> Convert<Rgb<Linear<S>, L>, Rgb<S, E>> for FromLinearLut<L, E, <S as RgbStandard>::TransferFn, T>

Source§

impl<T, I, O> Convert<I, O> for Box<T>
where T: Convert<I, O>,

Available on crate feature alloc only.
Source§

impl<WpParam, T, I, O> Convert<I, O> for BakedParameters<WpParam, T>
where BakedParameters<WpParam, T>: ConvertOnce<I, O> + Copy,