pub unsafe trait RawPixel<T> {
    // Required methods
    fn channels(&self) -> usize;
    unsafe fn from_raw_parts<'a>(pointer: *const T, length: usize) -> &'a Self;
    unsafe fn from_raw_parts_mut<'a>(
        pointer: *mut T,
        length: usize
    ) -> &'a mut Self;
    fn as_ptr(&self) -> *const T;
    fn as_mut_ptr(&mut self) -> *mut T;
}
Expand description

A contiguous sequence of pixel channels.

It’s used when converting to and from raw pixel data and should only be implemented for types with a suitable in-memory representation.

Required Methods§

source

fn channels(&self) -> usize

The length of the sequence.

source

unsafe fn from_raw_parts<'a>(pointer: *const T, length: usize) -> &'a Self

Convert from a pointer and a length.

source

unsafe fn from_raw_parts_mut<'a>(pointer: *mut T, length: usize) -> &'a mut Self

Convert from a mutable pointer and a length.

source

fn as_ptr(&self) -> *const T

Convert to a pointer.

source

fn as_mut_ptr(&mut self) -> *mut T

Convert to a mutable pointer.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> RawPixel<T> for [T]

source§

fn channels(&self) -> usize

source§

unsafe fn from_raw_parts<'a>(pointer: *const T, length: usize) -> &'a [T]

source§

unsafe fn from_raw_parts_mut<'a>(pointer: *mut T, length: usize) -> &'a mut [T]

source§

fn as_ptr(&self) -> *const T

source§

fn as_mut_ptr(&mut self) -> *mut T

Implementors§

source§

impl<P, T> RawPixel<T> for P
where P: RawPixelSized<T>,