pub struct SliceMut<'a, A, const N: usize> { /* private fields */ }Expand description
An indexable representation of a mutable subset of a RingBuffer.
Implementations§
Source§impl<'a, A: 'a, const N: usize> SliceMut<'a, A, N>
impl<'a, A: 'a, const N: usize> SliceMut<'a, A, N>
Sourcepub unsafe fn get_unchecked(&self, index: usize) -> &A
pub unsafe fn get_unchecked(&self, index: usize) -> &A
Get an unchecked reference to the value at the given index.
§Safety
You must ensure the index is not out of bounds.
Sourcepub unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut A
pub unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut A
Get an unchecked mutable reference to the value at the given index.
§Safety
You must ensure the index is not out of bounds.
Sourcepub fn iter(&self) -> Iter<'_, A, N> ⓘ
pub fn iter(&self) -> Iter<'_, A, N> ⓘ
Get an iterator over references to the items in the slice in order.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, A, N> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, A, N> ⓘ
Get an iterator over mutable references to the items in the slice in order.
Sourcepub fn slice<R: RangeBounds<usize>>(self, range: R) -> SliceMut<'a, A, N>
pub fn slice<R: RangeBounds<usize>>(self, range: R) -> SliceMut<'a, A, N>
Create a subslice of this slice.
This consumes the slice. Because the slice works like a mutable
reference, you can only have one slice over a given subset of a
RingBuffer at any one time, so that’s just how it’s got to be.
Sourcepub fn split_at(self, index: usize) -> (SliceMut<'a, A, N>, SliceMut<'a, A, N>)
pub fn split_at(self, index: usize) -> (SliceMut<'a, A, N>, SliceMut<'a, A, N>)
Split the slice into two subslices at the given index.
Sourcepub fn to_owned(&self) -> RingBuffer<A, N>where
A: Clone,
pub fn to_owned(&self) -> RingBuffer<A, N>where
A: Clone,
Construct a new RingBuffer by copying the elements in this slice.
Trait Implementations§
Source§impl<'a, A: 'a, const N: usize> Array for SliceMut<'a, A, N>
impl<'a, A: 'a, const N: usize> Array for SliceMut<'a, A, N>
Source§fn contains(&self, target: &Self::Output) -> bool
fn contains(&self, target: &Self::Output) -> bool
target exists in the array.Source§fn binary_search(&self, target: &Self::Output) -> Result<usize, usize>
fn binary_search(&self, target: &Self::Output) -> Result<usize, usize>
target.Source§fn binary_search_by<F>(&self, compare: F) -> Result<usize, usize>
fn binary_search_by<F>(&self, compare: F) -> Result<usize, usize>
Source§fn binary_search_by_key<K, F>(
&self,
key: &K,
extract: F,
) -> Result<usize, usize>
fn binary_search_by_key<K, F>( &self, key: &K, extract: F, ) -> Result<usize, usize>
Source§fn is_sorted_by<F>(&self, compare: F) -> bool
fn is_sorted_by<F>(&self, compare: F) -> bool
Source§fn is_sorted_by_key<K, F>(&self, extract: F) -> bool
fn is_sorted_by_key<K, F>(&self, extract: F) -> bool
Source§fn starts_with(&self, slice: &[Self::Output]) -> bool
fn starts_with(&self, slice: &[Self::Output]) -> bool
slice.Source§impl<'a, A: 'a, const N: usize> ArrayMut for SliceMut<'a, A, N>
impl<'a, A: 'a, const N: usize> ArrayMut for SliceMut<'a, A, N>
Source§fn get_mut(&mut self, index: usize) -> Option<&mut A>
fn get_mut(&mut self, index: usize) -> Option<&mut A>
Get a mutable reference to the value at a given index.
Source§fn first_mut(&mut self) -> Option<&mut Self::Output>
fn first_mut(&mut self) -> Option<&mut Self::Output>
Source§fn last_mut(&mut self) -> Option<&mut Self::Output>
fn last_mut(&mut self) -> Option<&mut Self::Output>
Source§fn set(&mut self, index: usize, value: Self::Output) -> Option<Self::Output>
fn set(&mut self, index: usize, value: Self::Output) -> Option<Self::Output>
Source§fn map_pair<F, A>(&mut self, index1: usize, index2: usize, f: F) -> A
fn map_pair<F, A>(&mut self, index1: usize, index2: usize, f: F) -> A
Source§fn sort_unstable_by<F>(&mut self, compare: F)
fn sort_unstable_by<F>(&mut self, compare: F)
Source§impl<'a, A: 'a, const N: usize> From<&'a mut RingBuffer<A, N>> for SliceMut<'a, A, N>
impl<'a, A: 'a, const N: usize> From<&'a mut RingBuffer<A, N>> for SliceMut<'a, A, N>
Source§fn from(buffer: &'a mut RingBuffer<A, N>) -> Self
fn from(buffer: &'a mut RingBuffer<A, N>) -> Self
Source§impl<'a, 'b, A: 'a, const N: usize> IntoIterator for &'a SliceMut<'a, A, N>
impl<'a, 'b, A: 'a, const N: usize> IntoIterator for &'a SliceMut<'a, A, N>
Source§impl<'a, 'b, A: 'a, const N: usize> IntoIterator for &'a mut SliceMut<'a, A, N>
impl<'a, 'b, A: 'a, const N: usize> IntoIterator for &'a mut SliceMut<'a, A, N>
Source§impl<'a, A: Ord + 'a, const N: usize> Ord for SliceMut<'a, A, N>
impl<'a, A: Ord + 'a, const N: usize> Ord for SliceMut<'a, A, N>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'a, A: PartialEq + 'a, const N: usize> PartialEq<RingBuffer<A, N>> for SliceMut<'a, A, N>
impl<'a, A: PartialEq + 'a, const N: usize> PartialEq<RingBuffer<A, N>> for SliceMut<'a, A, N>
Source§fn eq(&self, other: &RingBuffer<A, N>) -> bool
fn eq(&self, other: &RingBuffer<A, N>) -> bool
self and other values to be equal, and is used by ==.