Skip to main content

SliceExt

Trait SliceExt 

Source
pub trait SliceExt<E: CubePrimitive> {
Show 18 methods // Required methods fn __expand_as_vectorized<'infer>( scope: &Scope, this: &'infer SliceExpand<E>, ) -> &'infer SliceExpand<Vector<E::Scalar, E::Size>>; fn __expand_as_vectorized_mut<'infer>( scope: &Scope, this: &'infer mut SliceExpand<E>, ) -> &'infer mut SliceExpand<Vector<E::Scalar, E::Size>>; fn __expand_downcast<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer SliceExpand<E>, ) -> &'infer SliceExpand<T>; fn __expand_downcast_mut<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer mut SliceExpand<E>, ) -> &'infer mut SliceExpand<T>; fn __expand_downcast_unchecked<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer SliceExpand<E>, ) -> &'infer SliceExpand<T>; fn __expand_downcast_mut_unchecked<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer mut SliceExpand<E>, ) -> &'infer mut SliceExpand<T>; fn __expand_as_ptr( scope: &Scope, this: &SliceExpand<E>, ) -> *const NativeExpand<E>; fn __expand_as_mut_ptr( scope: &Scope, this: &mut SliceExpand<E>, ) -> *mut NativeExpand<E>; // Provided methods fn as_vectorized(&self) -> &[Vector<E::Scalar, E::Size>] { ... } fn as_vectorized_mut(&mut self) -> &mut [Vector<E::Scalar, E::Size>] { ... } fn downcast<T: CubePrimitive>(&self) -> &[T] { ... } fn downcast_mut<T: CubePrimitive>(&mut self) -> &mut [T] { ... } unsafe fn downcast_unchecked<T: CubePrimitive>(&self) -> &[T] { ... } unsafe fn downcast_mut_unchecked<T: CubePrimitive>(&mut self) -> &mut [T] { ... } unsafe fn as_mut_unchecked(&self) -> &mut [E] { ... } unsafe fn as_ptr_unchecked(&self) -> *const E { ... } unsafe fn as_mut_ptr_unchecked(&mut self) -> *mut E { ... } unsafe fn as_boxed_unchecked(&self) -> Box<[E]> { ... }
}

Required Methods§

Source

fn __expand_as_vectorized<'infer>( scope: &Scope, this: &'infer SliceExpand<E>, ) -> &'infer SliceExpand<Vector<E::Scalar, E::Size>>

Source

fn __expand_as_vectorized_mut<'infer>( scope: &Scope, this: &'infer mut SliceExpand<E>, ) -> &'infer mut SliceExpand<Vector<E::Scalar, E::Size>>

Source

fn __expand_downcast<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer SliceExpand<E>, ) -> &'infer SliceExpand<T>

Source

fn __expand_downcast_mut<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer mut SliceExpand<E>, ) -> &'infer mut SliceExpand<T>

Source

fn __expand_downcast_unchecked<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer SliceExpand<E>, ) -> &'infer SliceExpand<T>

Source

fn __expand_downcast_mut_unchecked<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer mut SliceExpand<E>, ) -> &'infer mut SliceExpand<T>

Source

fn __expand_as_ptr( scope: &Scope, this: &SliceExpand<E>, ) -> *const NativeExpand<E>

Source

fn __expand_as_mut_ptr( scope: &Scope, this: &mut SliceExpand<E>, ) -> *mut NativeExpand<E>

Provided Methods§

Source

fn as_vectorized(&self) -> &[Vector<E::Scalar, E::Size>]

Returns the same slice, but with the type reinterpreted as Vector. Preserves existing vector size of the primitive.

Source

fn as_vectorized_mut(&mut self) -> &mut [Vector<E::Scalar, E::Size>]

Returns the same slice, but with the type reinterpreted as Vector. Preserves existing vector size of the primitive.

Source

fn downcast<T: CubePrimitive>(&self) -> &[T]

Downcast the slice to the given type and panic if the type isn’t the same.

This function should only be used to satisfy the Rust type system, when two generic types are supposed to be the same.

Source

fn downcast_mut<T: CubePrimitive>(&mut self) -> &mut [T]

Downcast the slice to the given type and panic if the type isn’t the same.

This function should only be used to satisfy the Rust type system, when two generic types are supposed to be the same.

Source

unsafe fn downcast_unchecked<T: CubePrimitive>(&self) -> &[T]

Unsafely downcast the slice to the given type and panic if the type isn’t the same.

§Safety

This function converts unsafely, and should only be used for temporary storage with a dummy type (i.e. ReinterpretSlice)

Source

unsafe fn downcast_mut_unchecked<T: CubePrimitive>(&mut self) -> &mut [T]

Unsafely downcast the slice to the given type and panic if the type isn’t the same.

§Safety

This function converts unsafely, and should only be used for temporary storage with a dummy type (i.e. ReinterpretSlice)

Source

unsafe fn as_mut_unchecked(&self) -> &mut [E]

Unsafely cast an immutable slice to a mutable one.

§Safety

This is safe in practice, but breaks semantics. Should only be used if absolutely necessary. May cause problems if an immutable input is reinterpreted as mutable.

Source

unsafe fn as_ptr_unchecked(&self) -> *const E

Convert the slice to a start pointer, without any bounds checks.

§Safety

See get_unchecked

Source

unsafe fn as_mut_ptr_unchecked(&mut self) -> *mut E

Convert the slice to a mutable start pointer, without any bounds checks.

§Safety

See get_unchecked_mut

Source

unsafe fn as_boxed_unchecked(&self) -> Box<[E]>

Convert to an owned boxed slice. This is very unsafe as it completely erases the lifetime. Only use it for global kernel inputs, which have a static lifetime.

§Safety

Erases the lifetime. Only use when an owned representation is absolutely needed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<E: CubePrimitive> SliceExt<E> for [E]

Source§

fn __expand_as_vectorized<'infer>( scope: &Scope, this: &'infer SliceExpand<E>, ) -> &'infer SliceExpand<Vector<E::Scalar, E::Size>>

Source§

fn __expand_as_vectorized_mut<'infer>( scope: &Scope, this: &'infer mut SliceExpand<E>, ) -> &'infer mut SliceExpand<Vector<E::Scalar, E::Size>>

Source§

fn __expand_downcast<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer SliceExpand<E>, ) -> &'infer SliceExpand<T>

Source§

fn __expand_downcast_mut<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer mut SliceExpand<E>, ) -> &'infer mut SliceExpand<T>

Source§

fn __expand_downcast_unchecked<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer SliceExpand<E>, ) -> &'infer SliceExpand<T>

Source§

fn __expand_downcast_mut_unchecked<'infer, T: CubePrimitive>( scope: &Scope, this: &'infer mut SliceExpand<E>, ) -> &'infer mut SliceExpand<T>

Source§

fn __expand_as_ptr( scope: &Scope, this: &SliceExpand<E>, ) -> *const NativeExpand<E>

Source§

fn __expand_as_mut_ptr( scope: &Scope, this: &mut SliceExpand<E>, ) -> *mut NativeExpand<E>

Implementors§