[][src]Trait rgb::ComponentBytes

pub trait ComponentBytes<T: Pod> where
    Self: ComponentSlice<T>, 
{ fn as_bytes(&self) -> &[u8] { ... }
fn as_bytes_mut(&mut self) -> &mut [u8] { ... } }

Casting a slice of RGB/A values to a slice of u8

If instead of RGB8 you use RGB<MyCustomType>, and you want to cast from/to that custom type, implement the Plain trait for it:

unsafe impl rgb::Pod for MyCustomType {}
unsafe impl rgb::Zeroable for MyCustomType {}

Plain types are not allowed to contain struct padding, booleans, chars, enums, references or pointers.

Provided methods

fn as_bytes(&self) -> &[u8]

The components interpreted as raw bytes, in machine's native endian. In RGB bytes of the red component are first.

fn as_bytes_mut(&mut self) -> &mut [u8]

The components interpreted as raw bytes, in machine's native endian. In RGB bytes of the red component are first.

Loading content...

Implementations on Foreign Types

impl<T: Pod> ComponentBytes<T> for [RGB<T>][src]

impl<T: Pod> ComponentBytes<T> for [BGR<T>][src]

impl<T: Pod> ComponentBytes<T> for [RGBA<T>][src]

impl<T: Pod> ComponentBytes<T> for [BGRA<T>][src]

impl<T: Pod> ComponentBytes<T> for [ARGB<T>][src]

impl<T: Pod> ComponentBytes<T> for [ABGR<T>][src]

impl<T: Pod> ComponentBytes<T> for [GrayAlpha<T>][src]

impl<T: Pod> ComponentBytes<T> for [Gray<T>][src]

Loading content...

Implementors

Loading content...