pub struct PokeNdArray<'mem, 'facet> { /* private fields */ }Expand description
Lets you mutate an n-dimensional array (implements mutable facet_core::NdArrayVTable proxies)
Implementations§
Source§impl<'mem, 'facet> PokeNdArray<'mem, 'facet>
impl<'mem, 'facet> PokeNdArray<'mem, 'facet>
Sourcepub const unsafe fn new(value: Poke<'mem, 'facet>, def: NdArrayDef) -> Self
pub const unsafe fn new(value: Poke<'mem, 'facet>, def: NdArrayDef) -> Self
Creates a new poke ndarray.
§Safety
The caller must ensure that def contains valid vtable function pointers that
correctly implement the ndarray operations for the actual type, and that the
element type matches def.t().
Sourcepub fn get(&self, index: usize) -> Option<Peek<'_, 'facet>>
pub fn get(&self, index: usize) -> Option<Peek<'_, 'facet>>
Get a read-only view of the item at the given flat index.
Sourcepub fn get_mut(&mut self, index: usize) -> Option<Poke<'_, 'facet>>
pub fn get_mut(&mut self, index: usize) -> Option<Poke<'_, 'facet>>
Get a mutable view of the item at the given flat index.
Returns None if the underlying ndarray doesn’t provide mutable access or
if the index is out of bounds.
Sourcepub fn as_mut_ptr(&mut self) -> Result<PtrMut, StrideError>
pub fn as_mut_ptr(&mut self) -> Result<PtrMut, StrideError>
Get a mutable pointer to the start of the data buffer (if the array is strided).
Sourcepub fn byte_stride(&self, i: usize) -> Result<Option<isize>, StrideError>
pub fn byte_stride(&self, i: usize) -> Result<Option<isize>, StrideError>
Get the i-th stride in bytes.
Sourcepub const fn def(&self) -> NdArrayDef
pub const fn def(&self) -> NdArrayDef
Def getter.
Sourcepub const fn into_inner(self) -> Poke<'mem, 'facet>
pub const fn into_inner(self) -> Poke<'mem, 'facet>
Converts this PokeNdArray back into a Poke.
Sourcepub fn as_peek_ndarray(&self) -> PeekNdArray<'_, 'facet>
pub fn as_peek_ndarray(&self) -> PeekNdArray<'_, 'facet>
Returns a read-only PeekNdArray view.
Trait Implementations§
Auto Trait Implementations§
impl<'mem, 'facet> Freeze for PokeNdArray<'mem, 'facet>
impl<'mem, 'facet> RefUnwindSafe for PokeNdArray<'mem, 'facet>
impl<'mem, 'facet> !Send for PokeNdArray<'mem, 'facet>
impl<'mem, 'facet> !Sync for PokeNdArray<'mem, 'facet>
impl<'mem, 'facet> Unpin for PokeNdArray<'mem, 'facet>
impl<'mem, 'facet> UnsafeUnpin for PokeNdArray<'mem, 'facet>
impl<'mem, 'facet> !UnwindSafe for PokeNdArray<'mem, 'facet>
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