pub struct RowMut<'a, T> { /* private fields */ }
Expand description
Mutable row vector view with general column stride.
For usage examples, see MatRef
.
Implementations§
source§impl<'a, T> RowMut<'a, T>
impl<'a, T> RowMut<'a, T>
sourcepub unsafe fn from_raw_parts(
ptr: *mut T,
ncols: usize,
col_stride: isize
) -> Self
pub unsafe fn from_raw_parts( ptr: *mut T, ncols: usize, col_stride: isize ) -> Self
Returns a mutable row vector slice from the given arguments.
ptr
: pointer to the first element of the row vector.
ncols
: number of columns of the row vector.
col_stride
: offset between the first elements of two successive columns in the row vector.
Safety
ptr
must be non null and properly aligned for type T
.
For each j < ncols
,
ptr.offset(j as isize * col_stride)
must point to a valid
initialized object of type T
, unless memory pointing to that address is never read.
Additionally, when j != 0
, this pointer is never equal to ptr
(no self aliasing).
The referenced memory must not be accessed by another pointer which was not derived from
the return value, during the lifetime 'a
.
sourcepub fn as_ptr(self) -> *mut T
pub fn as_ptr(self) -> *mut T
Returns a mutable pointer to the first (left) element of the row vector.
sourcepub fn col_stride(&self) -> isize
pub fn col_stride(&self) -> isize
Returns the offset between the first elements of two successive columns in the row vector.
sourcepub fn ptr_at(self, j: usize) -> *mut T
pub fn ptr_at(self, j: usize) -> *mut T
Returns a mutable pointer to the element at position (0, j) in the row vector.
sourcepub unsafe fn ptr_in_bounds_at_unchecked(self, j: usize) -> *mut T
pub unsafe fn ptr_in_bounds_at_unchecked(self, j: usize) -> *mut T
Returns a mutable pointer to the element at position (0, j) in the row vector, assuming it falls within its bounds with no bound checks.
Safety
Requires that
j < self.ncols()
.
Otherwise, the behavior is undefined.
sourcepub fn ptr_in_bounds_at(self, j: usize) -> *mut T
pub fn ptr_in_bounds_at(self, j: usize) -> *mut T
Returns a mutable pointer to the element at position (0, j) in the row vector, while asserting that it falls within its bounds.
Panics
Requires that
j < self.ncols()
.
Otherwise, it panics.
sourcepub unsafe fn write_at_unchecked(&mut self, j: usize, value: T)
pub unsafe fn write_at_unchecked(&mut self, j: usize, value: T)
Writes the given value to the matrix at position (0, j) in the row vector, assuming it falls within its bounds with no bound checks.
Safety
Requires that
j < self.ncols()
.
Otherwise, the behavior is undefined.
sourcepub fn write_at(&mut self, j: usize, value: T)
pub fn write_at(&mut self, j: usize, value: T)
Writes the given value to the matrix at position (0, j) in the row vector, or panics if the index is out of bounds.
Panics
Requires that
j < self.ncols()
.
Otherwise, it panics.
sourcepub unsafe fn split_at_unchecked(self, j: usize) -> (Self, Self)
pub unsafe fn split_at_unchecked(self, j: usize) -> (Self, Self)
Splits the row vector into two parts in the following order: left, right.
Safety
Requires that
j <= self.ncols()
.
Otherwise, the behavior is undefined.
sourcepub fn split_at(self, j: usize) -> (Self, Self)
pub fn split_at(self, j: usize) -> (Self, Self)
Splits the row vector into two parts in the following order: left, right.
Panics
Requires that
j <= self.ncols()
.
Otherwise, it panics.
sourcepub unsafe fn get_unchecked(self, j: usize) -> &'a mut T
pub unsafe fn get_unchecked(self, j: usize) -> &'a mut T
Returns a mutable reference to the element at position (0, j), with no bound checks.
Safety
Requires j < self.ncols()
.
Otherwise, the behavior is undefined.
sourcepub fn get(self, j: usize) -> &'a mut T
pub fn get(self, j: usize) -> &'a mut T
Returns a mutable reference to the element at position (0, j), or panics if the index is out of bounds.
sourcepub unsafe fn subcols_unchecked(self, j: usize, ncols: usize) -> Self
pub unsafe fn subcols_unchecked(self, j: usize, ncols: usize) -> Self
Returns a view over subcolumns of self
, starting at position j
with a column count of ncols
.
Safety
Requires that
j <= self.ncols()
,ncols <= self.ncols() - j
.
Otherwise, the behavior is undefined.