pub struct SlicePlan { /* private fields */ }Expand description
A compiled static-slice traversal.
compile validates the fixed starts/limits/slice_strides contract and
lowers replay to a strided copy from the corresponding source view.
Implementations§
Source§impl SlicePlan
impl SlicePlan
Sourcepub fn compile(
operand_dims: &[usize],
operand_strides: &[isize],
dest_dims: &[usize],
dest_strides: &[isize],
starts: &[usize],
limits: &[usize],
slice_strides: &[usize],
) -> Result<SlicePlan, StridedError>
pub fn compile( operand_dims: &[usize], operand_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], starts: &[usize], limits: &[usize], slice_strides: &[usize], ) -> Result<SlicePlan, StridedError>
Compile a static slice plan for one operand layout and destination layout.
§Errors
Returns StridedError::StrideLengthMismatch when the operand or
destination layout lengths differ from the operand rank, and
StridedError::RankMismatch when starts, limits or
slice_strides differ from it. Returns
StridedError::InvalidAxis for a window with start > limit, a
limit beyond the extent, or a zero slice stride, and
StridedError::ShapeMismatch when the destination dims are not the
sliced extents. Returns StridedError::NonInjectiveOutputLayout
when two destination elements map onto one offset or the layout span is
not representable, and
StridedError::OffsetOverflow when an element count, a scaled
source stride, or the source offset delta overflows.
Sourcepub fn execute<T>(
&self,
dest: &mut RawStridedMut<'_, T>,
operand: &RawStridedRef<'_, T>,
exec: Exec<'_>,
) -> Result<(), StridedError>
pub fn execute<T>( &self, dest: &mut RawStridedMut<'_, T>, operand: &RawStridedRef<'_, T>, exec: Exec<'_>, ) -> Result<(), StridedError>
Execute the prepared static slice traversal.
§Errors
Returns StridedError::PlanLayoutMismatch when the views do not
carry the compiled operand and destination layouts, and
StridedError::OffsetOverflow when the operand offset plus the
compiled source offset delta overflows.
Sourcepub fn execute_uninit<T>(
&self,
dest: &mut RawStridedMut<'_, MaybeUninit<T>>,
operand: &RawStridedRef<'_, T>,
exec: Exec<'_>,
) -> Result<(), StridedError>
pub fn execute_uninit<T>( &self, dest: &mut RawStridedMut<'_, MaybeUninit<T>>, operand: &RawStridedRef<'_, T>, exec: Exec<'_>, ) -> Result<(), StridedError>
Execute into storage whose reachable destination elements are uninitialized.
§Errors
Returns StridedError::PlanLayoutMismatch when the views do not
carry the compiled operand and destination layouts, and
StridedError::OffsetOverflow when the operand offset plus the
compiled source offset delta overflows.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SlicePlan
impl RefUnwindSafe for SlicePlan
impl Send for SlicePlan
impl Sync for SlicePlan
impl Unpin for SlicePlan
impl UnsafeUnpin for SlicePlan
impl UnwindSafe for SlicePlan
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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