Trait sized_chunks::ring_buffer::ArrayMut[][src]

pub trait ArrayMut: Array + IndexMut<usize> {
    pub fn get_mut(&mut self, index: usize) -> Option<&mut Self::Output> { ... }
pub fn first_mut(&mut self) -> Option<&mut Self::Output> { ... }
pub fn last_mut(&mut self) -> Option<&mut Self::Output> { ... }
pub fn set(
        &mut self,
        index: usize,
        value: Self::Output
    ) -> Option<Self::Output>
    where
        Self::Output: Sized
, { ... }
pub fn swap(&mut self, index1: usize, index2: usize)
    where
        Self::Output: Sized
, { ... }
pub fn map_pair<F, A>(&mut self, index1: usize, index2: usize, f: F) -> A
    where
        F: FnMut(&mut Self::Output, &mut Self::Output) -> A
, { ... }
pub fn sort_unstable(&mut self)
    where
        Self::Output: Ord,
        Self::Output: Sized
, { ... }
pub fn sort_unstable_by<F>(&mut self, compare: F)
    where
        F: FnMut(&Self::Output, &Self::Output) -> Ordering,
        Self::Output: Sized
, { ... }
pub fn sort_unstable_by_key<F, K>(&mut self, extract: F)
    where
        K: Ord,
        F: FnMut(&Self::Output) -> K,
        Self::Output: Sized
, { ... } }

Trait for arrays with mutable indexes.

Provided methods

pub fn get_mut(&mut self, index: usize) -> Option<&mut Self::Output>[src]

Get a mutable reference to the element at the given index.

pub fn first_mut(&mut self) -> Option<&mut Self::Output>[src]

Get a mutable reference to the first element in the array.

pub fn last_mut(&mut self) -> Option<&mut Self::Output>[src]

Get a mutable reference to the last element in the array.

pub fn set(&mut self, index: usize, value: Self::Output) -> Option<Self::Output> where
    Self::Output: Sized
[src]

Set the value of the element at the given index.

Returns the previous value, or None if the index is out of bounds.

pub fn swap(&mut self, index1: usize, index2: usize) where
    Self::Output: Sized
[src]

Swap the elements at two indexes.

pub fn map_pair<F, A>(&mut self, index1: usize, index2: usize, f: F) -> A where
    F: FnMut(&mut Self::Output, &mut Self::Output) -> A, 
[src]

Get mutable references to the elements at two indexes and call a function on them.

This provides a safe way to get two mutable references into an array at the same time, which would normally be disallowed by the borrow checker.

pub fn sort_unstable(&mut self) where
    Self::Output: Ord,
    Self::Output: Sized
[src]

Sort the elements of the array.

pub fn sort_unstable_by<F>(&mut self, compare: F) where
    F: FnMut(&Self::Output, &Self::Output) -> Ordering,
    Self::Output: Sized
[src]

Sort the elements of the array using a comparator function.

pub fn sort_unstable_by_key<F, K>(&mut self, extract: F) where
    K: Ord,
    F: FnMut(&Self::Output) -> K,
    Self::Output: Sized
[src]

Sort the elements of the array using a key extractor function.

Loading content...

Implementations on Foreign Types

impl<A> ArrayMut for VecDeque<A>[src]

Loading content...

Implementors

impl<'a, A: 'a, N: ChunkLength<A> + 'a> ArrayMut for SliceMut<'a, A, N>[src]

#[must_use]fn get_mut(&mut self, index: usize) -> Option<&mut A>[src]

Get a mutable reference to the value at a given index.

impl<A, N> ArrayMut for RingBuffer<A, N> where
    N: ChunkLength<A>, 
[src]

#[must_use]fn get_mut(&mut self, index: usize) -> Option<&mut A>[src]

Get a mutable reference to the value at a given index.

Loading content...