Struct SliceMut

Source
pub struct SliceMut<E> { /* private fields */ }
Expand description

A read-write contiguous list of elements.

§Safety

Since data can be accessed by any unit during kernel execution, this can never be safe.

Implementations§

Source§

impl<E> SliceMut<E>

Source

pub fn len(&self) -> u32

Get the length of the slice.

Source

pub fn into_lined(self) -> SliceMut<Line<E>>
where E: CubePrimitive,

Returns the same slice, but with lines of length 1.

Source

pub fn try_cast_unchecked<T>(&self) -> SliceMut<T>

Try to cast 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§

impl<E: CubePrimitive> SliceMut<Line<E>>

Source

pub fn with_line_size(&self, line_size: u32) -> SliceMut<Line<E>>

Return a new SliceMut with updated line_size. This doesn’t copy or move the data, it simply reinterpret how they are loaded and stored in memory.

§Warning

Currently, this only work with cube(launch_unchecked) and is not supported on wgpu.

Source§

impl<E: CubePrimitive> SliceMut<E>

Source

pub unsafe fn index_unchecked<I: Index>(&self, _i: I) -> &E
where Self: CubeIndex<I>,

Perform an unchecked index into the array

§Safety

Out of bounds indexing causes undefined behaviour and may segfault. Ensure index is always in bounds

Source

pub unsafe fn index_assign_unchecked<I: Index>(&mut self, _i: I, _value: E)
where Self: CubeIndexMut<I>,

Perform an unchecked index assignment into the array

§Safety

Out of bounds indexing causes undefined behaviour and may segfault. Ensure index is always in bounds

Trait Implementations§

Source§

impl<E: Clone> Clone for SliceMut<E>

Source§

fn clone(&self) -> SliceMut<E>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: CubeType, I: Index> CubeIndex<I> for SliceMut<E>

Source§

type Output = E

Source§

fn cube_idx(&self, _i: T) -> &Self::Output

Source§

impl<E: CubeType, I: Index> CubeIndexMut<I> for SliceMut<E>

Source§

fn cube_idx_mut(&mut self, _i: T) -> &mut Self::Output

Source§

impl<E: CubeType> CubeType for &mut SliceMut<E>

Source§

type ExpandType = ExpandElementTyped<SliceMut<E>>

Source§

fn init(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType

Wrapper around the init method, necessary to type inference.
Source§

impl<E: CubeType> CubeType for SliceMut<E>

Source§

type ExpandType = ExpandElementTyped<SliceMut<E>>

Source§

fn init(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType

Wrapper around the init method, necessary to type inference.
Source§

impl<T: CubePrimitive> List<T> for SliceMut<T>

Source§

fn __expand_read( scope: &mut Scope, this: ExpandElementTyped<SliceMut<T>>, idx: ExpandElementTyped<u32>, ) -> ExpandElementTyped<T>

Source§

fn read(&self, index: u32) -> T

Source§

impl<T: CubePrimitive> ListMut<T> for SliceMut<T>

Source§

fn __expand_write( scope: &mut Scope, this: ExpandElementTyped<SliceMut<T>>, idx: ExpandElementTyped<u32>, value: ExpandElementTyped<T>, )

Source§

fn write(&self, index: u32, value: T)

Source§

impl<E: CubePrimitive> SliceOperator<E> for SliceMut<E>

Source§

type Expand = ExpandElementTyped<SliceMut<E>>

Source§

fn slice<Start: Index, End: Index>(&self, start: Start, end: End) -> Slice<E>

Return a read-only view of all elements comprise between the start and end indices. In checked mode, if the end index is out-of-bound, it is replaced by the length of self.
Source§

fn __expand_slice( scope: &mut Scope, expand: Self::Expand, start: ExpandElementTyped<u32>, end: ExpandElementTyped<u32>, ) -> ExpandElementTyped<Slice<E>>

Expand function of SliceOperator::slice.
Source§

fn slice_mut<Start: Index, End: Index>( &mut self, start: Start, end: End, ) -> SliceMut<E>

Return a read-write view of all elements comprise between the start and end indices. In checked mode, if the end index is out-of-bound, it is replaced by the length of self.
Source§

fn __expand_slice_mut( scope: &mut Scope, expand: Self::Expand, start: ExpandElementTyped<u32>, end: ExpandElementTyped<u32>, ) -> ExpandElementTyped<SliceMut<E>>

Expand function of SliceOperator::slice_mut.
Source§

fn to_slice(&self) -> Slice<E>

Reinterprete the current type as a read-only slice.
Source§

fn __expand_to_slice( scope: &mut Scope, expand: Self::Expand, ) -> ExpandElementTyped<Slice<E>>

Expand function of SliceOperator::to_slice.
Source§

fn to_slice_mut(&mut self) -> SliceMut<E>

Reinterprete the current type as a read-write slice.
Source§

fn __expand_to_slice_mut( scope: &mut Scope, expand: Self::Expand, ) -> ExpandElementTyped<SliceMut<E>>

Expand function of SliceOperator::to_slice_mut.
Source§

impl<E: Copy> Copy for SliceMut<E>

Auto Trait Implementations§

§

impl<E> Freeze for SliceMut<E>

§

impl<E> RefUnwindSafe for SliceMut<E>
where E: RefUnwindSafe,

§

impl<E> Send for SliceMut<E>
where E: Send,

§

impl<E> Sync for SliceMut<E>
where E: Sync,

§

impl<E> Unpin for SliceMut<E>
where E: Unpin,

§

impl<E> UnwindSafe for SliceMut<E>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V