pub struct RawStridedRef<'a, T> { /* private fields */ }Expand description
Borrowed raw strided input layout.
Use RawStridedRef::new for checked construction, or
RawStridedRef::new_unchecked when a higher-level compiled plan has
already validated bounds.
Implementations§
Source§impl<'a, T> RawStridedRef<'a, T>
impl<'a, T> RawStridedRef<'a, T>
Sourcepub fn new(
data: &'a [T],
dims: &'a [usize],
strides: &'a [isize],
offset: isize,
) -> Result<Self>
pub fn new( data: &'a [T], dims: &'a [usize], strides: &'a [isize], offset: isize, ) -> Result<Self>
Create a raw strided input 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 [T],
dims: &'a [usize],
strides: &'a [isize],
offset: isize,
) -> Self
pub unsafe fn new_unchecked( data: &'a [T], dims: &'a [usize], strides: &'a [isize], offset: isize, ) -> Self
Create a raw strided input without bounds checking.
§Safety
The caller must ensure every index reachable by dims/strides from
offset lies inside data.
pub fn data(&self) -> &'a [T]
pub fn dims(&self) -> &'a [usize]
pub fn strides(&self) -> &'a [isize]
pub fn offset(&self) -> isize
pub fn ptr(&self) -> *const T
Sourcepub fn as_view(&self) -> StridedView<'a, T, Identity>
pub fn as_view(&self) -> StridedView<'a, 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.