pub struct SharedSubgrid<'g, V = f32> { /* private fields */ }
Implementations§
Sourcepub unsafe fn new(
ptr: NonNull<V>,
width: usize,
height: usize,
stride: usize,
) -> Self
pub unsafe fn new( ptr: NonNull<V>, width: usize, height: usize, stride: usize, ) -> Self
Create a SharedSubgrid
from raw pointer to the buffer, width, height and stride.
§Safety
The memory region specified by width
, height
and stride
must be valid.
Sourcepub fn from_buf(
buf: &'g [V],
width: usize,
height: usize,
stride: usize,
) -> Self
pub fn from_buf( buf: &'g [V], width: usize, height: usize, stride: usize, ) -> Self
Create a SharedSubgrid
from buffer slice, width, height and stride.
§Panic
Panics if:
- either
width
orheight
is zero, width
is greater thanstride
,- or the area specified by
width
,height
andstride
is larger thanbuf
.
pub fn width(&self) -> usize
pub fn height(&self) -> usize
pub fn get(&self, x: usize, y: usize) -> &V
pub fn get_row(&self, row: usize) -> &[V]
Sourcepub fn split_horizontal(
&self,
x: usize,
) -> (SharedSubgrid<'g, V>, SharedSubgrid<'g, V>)
pub fn split_horizontal( &self, x: usize, ) -> (SharedSubgrid<'g, V>, SharedSubgrid<'g, V>)
Sourcepub fn split_vertical(
&self,
y: usize,
) -> (SharedSubgrid<'g, V>, SharedSubgrid<'g, V>)
pub fn split_vertical( &self, y: usize, ) -> (SharedSubgrid<'g, V>, SharedSubgrid<'g, V>)
pub fn subgrid( &self, range_x: impl RangeBounds<usize>, range_y: impl RangeBounds<usize>, ) -> SharedSubgrid<'g, V>
pub fn as_vectored<V: SimdVector>(&self) -> Option<SharedSubgrid<'g, V>>
Sourcepub unsafe fn as_atomic_i32(&self) -> SharedSubgrid<'g, AtomicI32>
pub unsafe fn as_atomic_i32(&self) -> SharedSubgrid<'g, AtomicI32>
§Safety
Caller should make sure that atomic and non-atomic accesses are not mixed.
Trait Implementations§
Source§fn clone(&self) -> SharedSubgrid<'g, V>
fn clone(&self) -> SharedSubgrid<'g, V>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§fn from(value: &'g AlignedGrid<V>) -> Self
fn from(value: &'g AlignedGrid<V>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more