pub struct MutSlice2<'a, T>(/* private fields */);Expand description
A mutable rectangular view to a region of a Buf2, a Slice2,
or in general any &[T] slice of memory.
Implementations§
Methods from Deref<Target = Inner<T, &'a mut [T]>>§
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Returns whether the rows of self are stored as one contiguous
slice, without gaps between rows.
Buf2 instances are always contiguous. A Slice2 or MutSlice2
instance is contiguous if its width equals its stride, if its
height is 1, or if it is empty.
Sourcepub fn slice(&self, rect: impl Into<Rect>) -> Slice2<'_, T>
pub fn slice(&self, rect: impl Into<Rect>) -> Slice2<'_, T>
Returns a borrowed rectangular slice of self.
§Panics
If any part of rect is outside the bounds of self.
Sourcepub fn get(&self, pos: impl Into<Vec2u>) -> Option<&T>
pub fn get(&self, pos: impl Into<Vec2u>) -> Option<&T>
Returns a reference to the element at pos,
or None if pos is out of bounds.
Sourcepub fn rows(&self) -> impl Iterator<Item = &[T]>
pub fn rows(&self) -> impl Iterator<Item = &[T]>
Returns an iterator over the rows of self as &[T] slices.
The length of each slice equals self.width().
Sourcepub fn iter(&self) -> impl Iterator<Item = &T>
pub fn iter(&self) -> impl Iterator<Item = &T>
Returns an iterator over all the elements of self in row-major order.
First returns the elements on row 0 from left to right, followed by the elements on row 1, and so on.
Sourcepub fn as_mut_slice2(&mut self) -> MutSlice2<'_, T>
pub fn as_mut_slice2(&mut self) -> MutSlice2<'_, T>
Returns a mutably borrowed rectangular slice of self.
Sourcepub fn rows_mut(&mut self) -> impl Iterator<Item = &mut [T]>
pub fn rows_mut(&mut self) -> impl Iterator<Item = &mut [T]>
Returns an iterator over the rows of this buffer as &mut [T].
The length of each slice equals self.width().
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>
Returns an iterator over all the elements of self in row-major
order: first the elements on row 0 from left to right, followed
by the elements on row 1, and so on.
Sourcepub fn fill_with<F>(&mut self, fill_fn: F)
pub fn fill_with<F>(&mut self, fill_fn: F)
Fills self by invoking f(x, y) for every element, where
x and y are the column and row of the element, respectively.
Sourcepub fn copy_from(&mut self, src: impl AsSlice2<T>)where
T: Copy,
pub fn copy_from(&mut self, src: impl AsSlice2<T>)where
T: Copy,
Copies each element in src to the same position in self.
This operation is often called “blitting”.
§Panics
if the dimensions of self and src don’t match.
Trait Implementations§
Source§impl<T> AsMutSlice2<T> for MutSlice2<'_, T>
impl<T> AsMutSlice2<T> for MutSlice2<'_, T>
Source§fn as_mut_slice2(&mut self) -> MutSlice2<'_, T>
fn as_mut_slice2(&mut self) -> MutSlice2<'_, T>
MutSlice2 view of Self.Auto Trait Implementations§
impl<'a, T> Freeze for MutSlice2<'a, T>
impl<'a, T> RefUnwindSafe for MutSlice2<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for MutSlice2<'a, T>where
T: Send,
impl<'a, T> Sync for MutSlice2<'a, T>where
T: Sync,
impl<'a, T> Unpin for MutSlice2<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for MutSlice2<'a, T>
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<Buf> Target for Bufwhere
Buf: AsMutSlice2<u32>,
impl<Buf> Target for Bufwhere
Buf: AsMutSlice2<u32>,
Source§fn rasterize<V, Fs>(
&mut self,
sl: Scanline<V>,
fs: &Fs,
ctx: &Context,
) -> Throughputwhere
V: Vary,
Fs: FragmentShader<V>,
fn rasterize<V, Fs>(
&mut self,
sl: Scanline<V>,
fs: &Fs,
ctx: &Context,
) -> Throughputwhere
V: Vary,
Fs: FragmentShader<V>,
Rasterizes scanline into this u32 color buffer.
Does no z-buffering.