pub trait RawSliceMut: Collection {
// Required methods
fn raw_slice_mut(&mut self) -> &mut [Self::Scalar];
fn raw_set_slice(&mut self, scalars: &[Self::Scalar]);
fn raw_set<const N: usize>(self, scalars: [Self::Scalar; N]) -> Self;
fn with_row_major(self, scalars: &[Self::Scalar]) -> Self;
fn with_column_major(self, scalars: &[Self::Scalar]) -> Self;
// Provided method
fn set<const N: usize>(self, scalars: [Self::Scalar; N]) -> Self
where Self: Sized { ... }
}Expand description
Trait for accessing and modifying the underlying data of a collection as a mutable slice.
Required Methods§
Sourcefn raw_slice_mut(&mut self) -> &mut [Self::Scalar]
fn raw_slice_mut(&mut self) -> &mut [Self::Scalar]
Returns a mutable reference to the underlying data as a flat array.
§Returns
- A mutable slice of the scalar data.
Sourcefn raw_set_slice(&mut self, scalars: &[Self::Scalar])
fn raw_set_slice(&mut self, scalars: &[Self::Scalar])
Sourcefn with_row_major(self, scalars: &[Self::Scalar]) -> Self
fn with_row_major(self, scalars: &[Self::Scalar]) -> Self
Sets the underlying data from an array of scalars, assuming the input to be in row major order. The resulting data will conform to the type of matrix used - row major or column major.
§Arguments
scalars: An array of scalars to set the data.
§Returns
- The modified collection with the new scalar data.
Example:
If scalars = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ],
then internally it will be placed in memory like this:
For Row major matrix: [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
For Column major matrix: [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ]
Sourcefn with_column_major(self, scalars: &[Self::Scalar]) -> Self
fn with_column_major(self, scalars: &[Self::Scalar]) -> Self
Sets the underlying data from an array of scalars, assuming the input to be in column major order. The resulting data will conform to the type of matrix used - row major or column major.
/// # Arguments
scalars: An array of scalars to set the data.
§Returns
- The modified collection with the new scalar data.
Example:
If scalars = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ],
then internally it will be placed in memory like this:
For Row major matrix: [ 1.0, 3.0, 5.0, 2.0, 4.0, 6.0 ]
For Column major matrix: [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.