rgb

Trait ComponentSlice

source
pub trait ComponentSlice<T> {
    // Required methods
    fn as_slice(&self) -> &[T];
    fn as_mut_slice(&mut self) -> &mut [T];
}
Expand description

Casting the struct to slices of its components

Required Methods§

source

fn as_slice(&self) -> &[T]

The components interpreted as an array, e.g. one RGB expands to 3 elements.

It’s implemented for individual pixels as well as slices of pixels.

source

fn as_mut_slice(&mut self) -> &mut [T]

The components interpreted as a mutable array, e.g. one RGB expands to 3 elements.

It’s implemented for individual pixels as well as slices of pixels.

If you get an error when calling this on an array, add [..]

use of unstable library feature ‘array_methods’

arr[..].as_mut_slice()

Implementations on Foreign Types§

source§

impl<T> ComponentSlice<T> for [Gray<T>]

source§

fn as_slice(&self) -> &[T]

source§

fn as_mut_slice(&mut self) -> &mut [T]

source§

impl<T> ComponentSlice<T> for [GrayAlpha<T>]

source§

fn as_slice(&self) -> &[T]

source§

fn as_mut_slice(&mut self) -> &mut [T]

source§

impl<T> ComponentSlice<T> for [Abgr<T>]

source§

fn as_slice(&self) -> &[T]

source§

fn as_mut_slice(&mut self) -> &mut [T]

source§

impl<T> ComponentSlice<T> for [Argb<T>]

source§

fn as_slice(&self) -> &[T]

source§

fn as_mut_slice(&mut self) -> &mut [T]

source§

impl<T> ComponentSlice<T> for [Bgr<T>]

source§

fn as_slice(&self) -> &[T]

source§

fn as_mut_slice(&mut self) -> &mut [T]

source§

impl<T> ComponentSlice<T> for [Bgra<T>]

source§

fn as_slice(&self) -> &[T]

source§

fn as_mut_slice(&mut self) -> &mut [T]

source§

impl<T> ComponentSlice<T> for [Grb<T>]

source§

fn as_slice(&self) -> &[T]

source§

fn as_mut_slice(&mut self) -> &mut [T]

source§

impl<T> ComponentSlice<T> for [Rgb<T>]

source§

fn as_slice(&self) -> &[T]

source§

fn as_mut_slice(&mut self) -> &mut [T]

source§

impl<T> ComponentSlice<T> for [Rgba<T>]

source§

fn as_slice(&self) -> &[T]

source§

fn as_mut_slice(&mut self) -> &mut [T]

Implementors§

source§

impl<T> ComponentSlice<T> for Gray<T>

source§

impl<T> ComponentSlice<T> for GrayAlpha<T>

source§

impl<T> ComponentSlice<T> for Abgr<T>

source§

impl<T> ComponentSlice<T> for Argb<T>

source§

impl<T> ComponentSlice<T> for Bgr<T>

source§

impl<T> ComponentSlice<T> for Bgra<T>

source§

impl<T> ComponentSlice<T> for Grb<T>

source§

impl<T> ComponentSlice<T> for Rgb<T>

source§

impl<T> ComponentSlice<T> for Rgba<T>