Type Alias imgref::ImgRefMut

source ·
pub type ImgRefMut<'a, Pixel> = Img<&'a mut [Pixel]>;
Expand description

Same as ImgRef, but mutable Pass this structure by value (i.e. ImgRef, not &ImgRef).

Aliased Type§

struct ImgRefMut<'a, Pixel> {
    pub buf: &'a mut [Pixel],
    pub stride: usize,
    pub width: u32,
    pub height: u32,
}

Fields§

§buf: &'a mut [Pixel]
👎Deprecated: Don’t access struct fields directly. Use buf(), buf_mut() or into_buf()

Storage for the pixels. Usually Vec<Pixel> or &[Pixel]. See ImgVec and ImgRef.

Note that future version will make this field private. Use .rows() and .pixels() iterators where possible, or buf()/buf_mut()/into_buf().

§stride: usize
👎Deprecated: Don’t access struct fields directly. Use stride()

Number of pixels to skip in the container to advance to the next row.

Note: pixels between width and stride may not be usable, and may not even exist in the last row.

§width: u32
👎Deprecated: Don’t access struct fields directly. Use width()

Width of the image in pixels.

Note that this isn’t same as the width of the row in the buf, see stride

§height: u32
👎Deprecated: Don’t access struct fields directly. Use height()

Height of the image in pixels.

Implementations§

source§

impl<'a, T> ImgRefMut<'a, T>

source

pub fn sub_image( &'a mut self, left: usize, top: usize, width: usize, height: usize ) -> ImgRef<'a, T>

Turn this into immutable reference, and slice a subregion of it

source

pub fn sub_image_mut( &mut self, left: usize, top: usize, width: usize, height: usize ) -> ImgRefMut<'_, T>

Trim this image without copying. Note that mutable borrows are exclusive, so it’s not possible to have more than one mutable subimage at a time.

source

pub fn as_ref(&self) -> ImgRef<'_, T>

Make mutable reference immutable

source§

impl<'a, T: Copy> ImgRefMut<'a, T>

source

pub fn pixels(&self) -> PixelsIter<'_, T>

§Panics

If you want to iterate in parallel, parallelize rows() instead.

if width is 0

source

pub fn pixels_mut(&mut self) -> PixelsIterMut<'_, T>

If you want to iterate in parallel, parallelize rows() instead.

§Panics

if width is 0

source§

impl<'a, T> ImgRefMut<'a, T>

source

pub fn rows(&self) -> RowsIter<'_, T>

Iterate over whole rows as slices

§Panics

if stride is 0

source

pub fn rows_mut(&mut self) -> RowsIterMut<'_, T>

Iterate over whole rows as slices

§Panics

if stride is 0

Trait Implementations§

source§

impl<'a, T: Hash> Hash for ImgRefMut<'a, T>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a, 'b, T, U> PartialEq<Img<&'b [U]>> for ImgRefMut<'a, T>
where T: PartialEq<U>,

source§

fn eq(&self, other: &ImgRef<'b, U>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b, T, U> PartialEq<Img<&'b mut [U]>> for ImgRefMut<'a, T>
where T: PartialEq<U>,

source§

fn eq(&self, other: &ImgRefMut<'b, U>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, T: Eq> Eq for ImgRefMut<'a, T>