image::color

Trait FromPrimitive

Source
pub trait FromPrimitive<Component> {
    // Required method
    fn from_primitive(component: Component) -> Self;
}
Expand description

Convert from one pixel component type to another. For example, convert from u8 to f32 pixel values.

Required Methods§

Source

fn from_primitive(component: Component) -> Self

Converts from any pixel component type to this type.

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.

Implementations on Foreign Types§

Source§

impl FromPrimitive<f32> for u8

Source§

fn from_primitive(float: f32) -> Self

Source§

impl FromPrimitive<f32> for u16

Source§

fn from_primitive(float: f32) -> Self

Source§

impl FromPrimitive<u8> for f32

Source§

fn from_primitive(int: u8) -> Self

Source§

impl FromPrimitive<u8> for u16

Source§

fn from_primitive(c8: u8) -> Self

Source§

impl FromPrimitive<u16> for f32

Source§

fn from_primitive(int: u16) -> Self

Source§

impl FromPrimitive<u16> for u8

Source§

fn from_primitive(c16: u16) -> Self

Implementors§