Trait sized_chunks::ring_buffer::ArrayMut [−][src]
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]
Self::Output: Sized,
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]
Self::Output: Sized,
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]
F: FnMut(&mut Self::Output, &mut Self::Output) -> A,
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]
Self::Output: Ord,
Self::Output: Sized,
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]
F: FnMut(&Self::Output, &Self::Output) -> Ordering,
Self::Output: Sized,
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]
K: Ord,
F: FnMut(&Self::Output) -> K,
Self::Output: Sized,
Sort the elements of the array using a key extractor function.
Implementations on Foreign Types
impl<A> ArrayMut for VecDeque<A>
[src]
pub fn get_mut(
&mut self,
index: usize
) -> Option<&mut <VecDeque<A> as Index<usize>>::Output>
[src]
&mut self,
index: usize
) -> Option<&mut <VecDeque<A> as Index<usize>>::Output>
pub fn swap(&mut self, index1: usize, index2: usize) where
<VecDeque<A> as Index<usize>>::Output: Sized,
[src]
<VecDeque<A> as Index<usize>>::Output: Sized,
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]
N: ChunkLength<A>,