pub struct StridedBytes { /* private fields */ }
Expand description

A validated layout of a rectangular matrix of pixels, treated as bytes.

The invariants are that the whole layout fits into memory, additionally ensuring that all indices within have proper indices into the byte slice containing the data.

The related containers StridedBufferRef and StridedBufferMut can be utilized to setup efficient initialization of data from different stride sources. Since they require only the alignment according to their elements, not according to the maximum alignment, they may be used for external data that is copied to an image.

Implementations

Try to create a new layout from a specification.

This fails if the specification does not describe a valid layout. The reasons for this include the element being misaligned according to the provided offsets/strides or the layout not describing a memory size expressible on the current architecture.

Construct a layout with zeroed strides, repeating one element.

Construct from a packed matrix of elements in column major layout.

This is guaranteed to succeed and will construct the strides such that a packed column major matrix of elements at offset zero is described.

Construct from a packed matrix of elements in row major layout.

This is guaranteed to succeed and will construct the strides such that a packed row major matrix of elements at offset zero is described.

Get the specification of this matrix.

Shrink the element’s size or alignment.

This is always valid since the new layout is strictly contained within the old one.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The valid strided specification of this layout. Read more

Try to use the matrix with a specific pixel type.

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

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.