pub struct ColMut<'a, T> { /* private fields */ }Expand description
Mutable column vector view with general row stride.
For usage examples, see MatRef.
Implementations
sourceimpl<'a, T> ColMut<'a, T>
impl<'a, T> ColMut<'a, T>
sourcepub unsafe fn from_raw_parts(ptr: *mut T, nrows: usize, row_stride: isize) -> Self
pub unsafe fn from_raw_parts(ptr: *mut T, nrows: usize, row_stride: isize) -> Self
Returns a mutable column vector slice from the given arguments.
ptr: pointer to the first element of the column vector.
ncols: number of columns of the column vector.
col_stride: offset between the first elements of two successive columns in the column
vector.
Safety
ptr must be non null and properly aligned for type T.
For each i < nrows,
ptr.offset(i as isize * row_stride) must point to a valid
initialized object of type T, unless memory pointing to that address is never read.
Additionally, when i != 0, this pointer is never equal to ptr (no self aliasing).
The referenced memory must not be mutated 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 (top) element of the column vector.
sourcepub fn ncols(&self) -> usize
pub fn ncols(&self) -> usize
Returns the number of columns of the column vector. Always returns 1.
sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Returns the offset between the first elements of two successive rows in the column vector.
sourcepub fn ptr_at(self, i: usize) -> *mut T
pub fn ptr_at(self, i: usize) -> *mut T
Returns a mutable pointer to the element at position (i, 0) in the column vector.
sourcepub unsafe fn ptr_in_bounds_at_unchecked(self, i: usize) -> *mut T
pub unsafe fn ptr_in_bounds_at_unchecked(self, i: usize) -> *mut T
Returns a mutable pointer to the element at position (i, 0) in the column vector, assuming it falls within its bounds with no bound checks.
Safety
Requires that i < self.nrows().
Otherwise, the behavior is undefined.
sourcepub fn ptr_in_bounds_at(self, i: usize) -> *mut T
pub fn ptr_in_bounds_at(self, i: usize) -> *mut T
Returns a mutable pointer to the element at position (i, 0) in the column vector, while asserting that it falls within its bounds.
Panics
Requires that i < self.nrows().
Otherwise, it panics.
sourcepub unsafe fn split_at_unchecked(self, i: usize) -> (Self, Self)
pub unsafe fn split_at_unchecked(self, i: usize) -> (Self, Self)
Splits the column vector into two parts in the following order: top, bottom.
Safety
Requires that i <= self.nrows().
Otherwise, the behavior is undefined.
sourcepub fn split_at(self, i: usize) -> (Self, Self)
pub fn split_at(self, i: usize) -> (Self, Self)
Splits the column vector into two parts in the following order: top, bottom.
Panics
Requires that i <= self.nrows().
Otherwise, it panics.
sourcepub unsafe fn get_unchecked(self, i: usize) -> &'a mut T
pub unsafe fn get_unchecked(self, i: usize) -> &'a mut T
Returns a mutable reference to the element at position (i, 0), with no bound checks.
Safety
Requires i < self.nrows().
Otherwise, the behavior is undefined.