pub struct StridedBufferMut<'data> { /* private fields */ }
Expand description

A reference to mutable byte of a strided matrix.

This can be constructed from a mutably borrowed image that is currently set to a strided layout such as a matrix. It can be regarded as a generalization to the standard matrix layout. Alternatively, it can be constructed directly from a mutable reference to raw bytes.

Usage

Here is an example of filling a matrix-like image with a constant value.

use image_texel::layout::Matrix;
use image_texel::image::{StridedBufferRef, StridedBufferMut, Image};

let layout = Matrix::<u32>::width_and_height(4, 4).unwrap();
let mut image = Image::new(layout);

let fill = StridedBufferRef::with_repeated_element(&0x42u32, 4, 4);
StridedBufferMut::new(&mut image).copy_from_image(fill);

assert_eq!(image.as_slice(), &[0x42; 16]);

Implementations

Construct a mutable reference to a strided image buffer.

View bytes mutably under a certain strided layout.

Unlike an image, the data need only be aligned to the element mentioned in the layout and not to the maximum alignment.

Shrink the element’s size or alignment.

Copy the bytes from another image.

The source must have the same width, height, and element size.

Borrow this as a reference to an immutable byte matrix.

Convert this into a reference to an immutable byte matrix.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.