pub struct ArrayViewMut2<'a, T> { /* private fields */ }Expand description
Mutable 2D array view.
Implementations§
Source§impl<'a, T> ArrayViewMut2<'a, T>
impl<'a, T> ArrayViewMut2<'a, T>
Sourcepub fn new(
data: &'a mut [T],
shape: [usize; 2],
strides: [isize; 2],
offset: isize,
) -> Result<Self>
pub fn new( data: &'a mut [T], shape: [usize; 2], strides: [isize; 2], offset: isize, ) -> Result<Self>
Create a checked mutable view.
Sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Distance in elements between consecutive rows.
Sourcepub fn col_stride(&self) -> isize
pub fn col_stride(&self) -> isize
Distance in elements between consecutive columns.
Sourcepub fn leading_dimension(&self) -> isize
pub fn leading_dimension(&self) -> isize
Leading dimension for the current row-major-style view.
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Whether the view is compact row-major contiguous.
Sourcepub fn as_view(&self) -> ArrayView2<'_, T>
pub fn as_view(&self) -> ArrayView2<'_, T>
Immutable view over the same region.
Sourcepub fn as_mut_slice(&mut self) -> Option<&mut [T]>
pub fn as_mut_slice(&mut self) -> Option<&mut [T]>
Borrow the backing slice if this view covers it contiguously.
Sourcepub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut T>
pub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut T>
Get a mutable element reference.
Sourcepub fn row_mut(&mut self, row: usize) -> Result<ArrayViewMut2<'_, T>>
pub fn row_mut(&mut self, row: usize) -> Result<ArrayViewMut2<'_, T>>
Return a mutable row view as a one-row matrix.
Sourcepub fn row_slice_mut(&mut self, row: usize) -> Result<Option<&mut [T]>>
pub fn row_slice_mut(&mut self, row: usize) -> Result<Option<&mut [T]>>
Borrow a mutable row as a contiguous slice when the row layout permits it.
Sourcepub fn col_mut(&mut self, col: usize) -> Result<ArrayViewMut2<'_, T>>
pub fn col_mut(&mut self, col: usize) -> Result<ArrayViewMut2<'_, T>>
Return a mutable column view as an rows x 1 matrix.
Sourcepub fn rows_range_mut(
&mut self,
start: usize,
end: usize,
) -> Result<ArrayViewMut2<'_, T>>
pub fn rows_range_mut( &mut self, start: usize, end: usize, ) -> Result<ArrayViewMut2<'_, T>>
Slice a mutable half-open row range.
Sourcepub fn cols_range_mut(
&mut self,
start: usize,
end: usize,
) -> Result<ArrayViewMut2<'_, T>>
pub fn cols_range_mut( &mut self, start: usize, end: usize, ) -> Result<ArrayViewMut2<'_, T>>
Slice a mutable half-open column range.
Source§impl<T: Clone> ArrayViewMut2<'_, T>
impl<T: Clone> ArrayViewMut2<'_, T>
Sourcepub fn to_row_major(&self) -> Array2<T>
pub fn to_row_major(&self) -> Array2<T>
Copy this view into compact row-major storage.
Sourcepub fn to_col_major_vec(&self) -> Vec<T>
pub fn to_col_major_vec(&self) -> Vec<T>
Copy this view into a column-major vector.
Sourcepub fn copy_from_view(&mut self, other: ArrayView2<'_, T>) -> Result<()>
pub fn copy_from_view(&mut self, other: ArrayView2<'_, T>) -> Result<()>
Copy values from another view with the same shape.
Trait Implementations§
Source§impl<'a, T: Debug> Debug for ArrayViewMut2<'a, T>
impl<'a, T: Debug> Debug for ArrayViewMut2<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for ArrayViewMut2<'a, T>
impl<'a, T> RefUnwindSafe for ArrayViewMut2<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for ArrayViewMut2<'a, T>where
T: Send,
impl<'a, T> Sync for ArrayViewMut2<'a, T>where
T: Sync,
impl<'a, T> Unpin for ArrayViewMut2<'a, T>
impl<'a, T> UnsafeUnpin for ArrayViewMut2<'a, T>
impl<'a, T> !UnwindSafe for ArrayViewMut2<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more