Skip to main content

ArrayViewMut

Struct ArrayViewMut 

Source
pub struct ArrayViewMut<'a, T: Element, D: Dimension> { /* private fields */ }
Expand description

A mutable, borrowed view into an existing array’s data.

This is a zero-copy mutable slice. The lifetime 'a ties this view to the source array, and Rust’s borrow checker ensures exclusivity.

Implementations§

Source§

impl<'a, T: Element, D: Dimension> ArrayViewMut<'a, T, D>

Source

pub fn shape(&self) -> &[usize]

Shape as a slice.

Source

pub fn ndim(&self) -> usize

Number of dimensions.

Source

pub fn size(&self) -> usize

Total number of elements.

Source

pub fn is_empty(&self) -> bool

Whether the view has zero elements.

Source

pub fn strides(&self) -> &[isize]

Strides as a slice.

Source

pub fn as_ptr(&self) -> *const T

Raw pointer to the first element.

Source

pub fn as_mut_ptr(&mut self) -> *mut T

Mutable raw pointer to the first element.

Source

pub fn as_slice(&self) -> Option<&[T]>

Try to get a contiguous slice.

Source

pub fn as_slice_mut(&mut self) -> Option<&mut [T]>

Try to get a contiguous mutable slice.

Source

pub fn layout(&self) -> MemoryLayout

Memory layout.

Source

pub fn dim(&self) -> &D

Return a reference to the internal dimension descriptor.

Source

pub fn flags(&self) -> ArrayFlags

Array flags for this mutable view.

Source§

impl<'a, T: Element, D: Dimension> ArrayViewMut<'a, T, D>

Source

pub fn slice_axis_mut( &mut self, axis: Axis, spec: SliceSpec, ) -> FerrayResult<ArrayViewMut<'_, T, IxDyn>>

Slice the mutable view along a given axis.

Auto Trait Implementations§

§

impl<'a, T, D> Freeze for ArrayViewMut<'a, T, D>
where D: Freeze, <D as Dimension>::NdarrayDim: Freeze,

§

impl<'a, T, D> RefUnwindSafe for ArrayViewMut<'a, T, D>

§

impl<'a, T, D> Send for ArrayViewMut<'a, T, D>

§

impl<'a, T, D> Sync for ArrayViewMut<'a, T, D>

§

impl<'a, T, D> Unpin for ArrayViewMut<'a, T, D>
where D: Unpin, <D as Dimension>::NdarrayDim: Unpin,

§

impl<'a, T, D> UnsafeUnpin for ArrayViewMut<'a, T, D>

§

impl<'a, T, D> !UnwindSafe for ArrayViewMut<'a, T, D>

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> 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, 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.