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>
impl<E> SliceMut<E>
Sourcepub fn into_lined(self) -> SliceMut<Line<E>>where
E: CubePrimitive,
pub fn into_lined(self) -> SliceMut<Line<E>>where
E: CubePrimitive,
Returns the same slice, but with lines of length 1.
Sourcepub fn try_cast_unchecked<T>(&self) -> SliceMut<T>where
E: CubePrimitive,
T: CubePrimitive,
pub fn try_cast_unchecked<T>(&self) -> SliceMut<T>where
E: CubePrimitive,
T: CubePrimitive,
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>>
impl<E: CubePrimitive> SliceMut<Line<E>>
Sourcepub fn with_line_size(&self, line_size: u32) -> SliceMut<Line<E>>
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>
impl<E: CubePrimitive> SliceMut<E>
Sourcepub unsafe fn index_unchecked<I: Index>(&self, _i: I) -> &Ewhere
Self: CubeIndex<I>,
pub unsafe fn index_unchecked<I: Index>(&self, _i: I) -> &Ewhere
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
Sourcepub unsafe fn index_assign_unchecked<I: Index>(&mut self, _i: I, _value: E)where
Self: CubeIndexMut<I>,
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: CubeType, I: Index> CubeIndexMut<I> for SliceMut<E>
impl<E: CubeType, I: Index> CubeIndexMut<I> for SliceMut<E>
fn cube_idx_mut(&mut self, _i: T) -> &mut Self::Output
Source§impl<E: CubeType> CubeType for &mut SliceMut<E>
impl<E: CubeType> CubeType for &mut SliceMut<E>
type ExpandType = ExpandElementTyped<SliceMut<E>>
Source§fn init(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType
fn init(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType
Source§impl<E: CubeType> CubeType for SliceMut<E>
impl<E: CubeType> CubeType for SliceMut<E>
type ExpandType = ExpandElementTyped<SliceMut<E>>
Source§fn init(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType
fn init(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType
Source§impl<T: CubePrimitive> List<T> for SliceMut<T>
impl<T: CubePrimitive> List<T> for SliceMut<T>
fn __expand_read( scope: &mut Scope, this: ExpandElementTyped<SliceMut<T>>, idx: ExpandElementTyped<u32>, ) -> ExpandElementTyped<T>
fn read(&self, index: u32) -> T
Source§impl<T: CubePrimitive> ListMut<T> for SliceMut<T>
impl<T: CubePrimitive> ListMut<T> for SliceMut<T>
fn __expand_write( scope: &mut Scope, this: ExpandElementTyped<SliceMut<T>>, idx: ExpandElementTyped<u32>, value: ExpandElementTyped<T>, )
fn write(&self, index: u32, value: T)
Source§impl<E: CubePrimitive> SliceOperator<E> for SliceMut<E>
impl<E: CubePrimitive> SliceOperator<E> for SliceMut<E>
type Expand = ExpandElementTyped<SliceMut<E>>
Source§fn slice<Start: Index, End: Index>(&self, start: Start, end: End) -> Slice<E> ⓘ
fn slice<Start: Index, End: Index>(&self, start: Start, end: End) -> Slice<E> ⓘ
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>>
fn __expand_slice( scope: &mut Scope, expand: Self::Expand, start: ExpandElementTyped<u32>, end: ExpandElementTyped<u32>, ) -> ExpandElementTyped<Slice<E>>
Source§fn slice_mut<Start: Index, End: Index>(
&mut self,
start: Start,
end: End,
) -> SliceMut<E>
fn slice_mut<Start: Index, End: Index>( &mut self, start: Start, end: End, ) -> SliceMut<E>
start
and end
indices.
In checked
mode, if the end
index is out-of-bound, it is replaced by
the length of self
.