pub trait ToBytes {
    type Bytes;

    // Required methods
    fn to_be_bytes(self) -> Self::Bytes;
    fn to_le_bytes(self) -> Self::Bytes;
    fn to_ne_bytes(self) -> Self::Bytes;
}
Expand description

Trait to convert colors into a byte array.

See the module-level documentation for an example.

Required Associated Types§

source

type Bytes

Return type of methods in this trait.

Required Methods§

source

fn to_be_bytes(self) -> Self::Bytes

Converts a color into a byte array with big endian byte order.

source

fn to_le_bytes(self) -> Self::Bytes

Converts a color into a byte array with little endian byte order.

source

fn to_ne_bytes(self) -> Self::Bytes

Converts a color into a byte array with native byte order.

Implementations on Foreign Types§

source§

impl ToBytes for ()

§

type Bytes = [u8; 0]

source§

fn to_be_bytes(self) -> <() as ToBytes>::Bytes

source§

fn to_le_bytes(self) -> <() as ToBytes>::Bytes

source§

fn to_ne_bytes(self) -> <() as ToBytes>::Bytes

Implementors§

source§

impl ToBytes for RawU1

§

type Bytes = [u8; 1]

source§

impl ToBytes for RawU2

§

type Bytes = [u8; 1]

source§

impl ToBytes for RawU4

§

type Bytes = [u8; 1]

source§

impl ToBytes for RawU8

§

type Bytes = [u8; 1]

source§

impl ToBytes for RawU16

§

type Bytes = [u8; 2]

source§

impl ToBytes for RawU24

§

type Bytes = [u8; 3]

source§

impl ToBytes for RawU32

§

type Bytes = [u8; 4]

source§

impl<C> ToBytes for Cwhere C: PixelColor + Into<<C as PixelColor>::Raw>,

§

type Bytes = <<C as PixelColor>::Raw as ToBytes>::Bytes