pub struct RawStridedMut<'a, T> { /* private fields */ }Expand description
Borrowed raw strided output layout.
This is the mutable counterpart to RawStridedRef. It avoids allocating
owned shape/stride metadata in prepared replay paths.
Implementations§
Source§impl<'a, T> RawStridedMut<'a, T>
impl<'a, T> RawStridedMut<'a, T>
Sourcepub fn new(
data: &'a mut [T],
dims: &'a [usize],
strides: &'a [isize],
offset: isize,
) -> Result<Self>
pub fn new( data: &'a mut [T], dims: &'a [usize], strides: &'a [isize], offset: isize, ) -> Result<Self>
Create a raw strided output after validating reachable offsets.
§Errors
Returns StridedError::StrideLengthMismatch when dims and
strides have different lengths, and
StridedError::OffsetOverflow when a reachable offset is not
representable: dim - 1 of a non-unit extent does not fit isize, a
stride times that last index or the accumulated offsets overflow
isize or go negative, or the highest reachable offset is not below
the buffer length. A layout with a zero extent skips this check.
Sourcepub unsafe fn new_unchecked(
data: &'a mut [T],
dims: &'a [usize],
strides: &'a [isize],
offset: isize,
) -> Self
pub unsafe fn new_unchecked( data: &'a mut [T], dims: &'a [usize], strides: &'a [isize], offset: isize, ) -> Self
Create a raw strided output without bounds checking.
§Safety
The caller must ensure every index reachable by dims/strides from
offset lies inside data, and no aliases violate mutable access.
pub fn data(&self) -> &[T]
pub fn data_mut(&mut self) -> &mut [T]
pub fn dims(&self) -> &'a [usize]
pub fn strides(&self) -> &'a [isize]
pub fn offset(&self) -> isize
pub fn ptr(&self) -> *const T
pub fn as_mut_ptr(&mut self) -> *mut T
Sourcepub fn as_view(&self) -> StridedView<'_, T, Identity>
pub fn as_view(&self) -> StridedView<'_, T, Identity>
Convert to an immutable view, borrowing this descriptor’s metadata.
The conversion allocates nothing; hot prepared paths use the raw accessors directly all the same.
Sourcepub fn as_view_mut(&mut self) -> StridedViewMut<'_, T>
pub fn as_view_mut(&mut self) -> StridedViewMut<'_, T>
Convert to a mutable view, borrowing this descriptor’s metadata.
The conversion allocates nothing; hot prepared paths use the raw accessors directly all the same.