Trait ArrayMut

Source
pub trait ArrayMut<T>: ArrayRef<T> {
    // Required methods
    fn as_slice_mut(&mut self) -> &mut [T];
    fn get_mut(&mut self, index: usize) -> Option<&mut T>;
    fn get_n_mut<Range>(&mut self, range: Range) -> Option<Array<&mut [T]>>
       where Range: RangeBounds<usize>;
    fn first_mut(&mut self) -> Option<&mut T>;
    fn last_mut(&mut self) -> Option<&mut T>;
    fn iter_mut(&mut self) -> SliceIterMut<'_, T> ;
    fn rotate_left(&mut self, count: usize);
    fn rotate_right(&mut self, count: usize);
    fn reverse(&mut self);
}
Expand description

A trait for mutably referencable linear array types

Required Methods§

Source

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

The underlying element as mutable slice

Source

fn get_mut(&mut self, index: usize) -> Option<&mut T>

Gets a mutable reference to an element

Source

fn get_n_mut<Range>(&mut self, range: Range) -> Option<Array<&mut [T]>>
where Range: RangeBounds<usize>,

Gets a mutable subrange

Source

fn first_mut(&mut self) -> Option<&mut T>

Returns a mutable reference to the first element

Source

fn last_mut(&mut self) -> Option<&mut T>

Returns a mutable reference to the last element

Source

fn iter_mut(&mut self) -> SliceIterMut<'_, T>

Returns an iterator that mutably references the elements

Source

fn rotate_left(&mut self, count: usize)

Rotates the elements left by count fields

Source

fn rotate_right(&mut self, count: usize)

Rotates the elements right by count fields

Source

fn reverse(&mut self)

Reverses the order of elements in the slice

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, Wrapped> ArrayMut<T> for Array<Wrapped>
where Wrapped: AsRef<[T]> + AsMut<[T]>,