Struct sized_chunks::ring_buffer::SliceMut
source · [−]pub struct SliceMut<'a, A, const N: usize> { /* private fields */ }
Expand description
An indexable representation of a mutable subset of a RingBuffer
.
Implementations
sourceimpl<'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>ⓘNotable traits for Iter<'a, A, N>impl<'a, A, const N: usize> Iterator for Iter<'a, A, N> type Item = &'a A;
pub fn iter(&self) -> Iter<'_, A, N>ⓘNotable traits for Iter<'a, A, N>impl<'a, A, const N: usize> Iterator for Iter<'a, A, N> type Item = &'a A;
Get an iterator over references to the items in the slice in order.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, A, N>ⓘNotable traits for IterMut<'a, A, N>impl<'a, A, const N: usize> Iterator for IterMut<'a, A, N> where
A: 'a, type Item = &'a mut A;
pub fn iter_mut(&mut self) -> IterMut<'_, A, N>ⓘNotable traits for IterMut<'a, A, N>impl<'a, A, const N: usize> Iterator for IterMut<'a, A, N> where
A: 'a, type Item = &'a mut A;
A: 'a, type Item = &'a mut A;
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>ⓘNotable traits for RingBuffer<u8, N>impl<const N: usize> Write for RingBuffer<u8, N>impl<const N: usize> Read for RingBuffer<u8, N>
where
A: Clone,
pub fn to_owned(&self) -> RingBuffer<A, N>ⓘNotable traits for RingBuffer<u8, N>impl<const N: usize> Write for RingBuffer<u8, N>impl<const N: usize> Read for RingBuffer<u8, N>
where
A: Clone,
Construct a new RingBuffer
by copying the elements in this slice.
Trait Implementations
sourceimpl<'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>
sourcefn contains(&self, target: &Self::Output) -> bool where
Self::Output: PartialEq<Self::Output>,
fn contains(&self, target: &Self::Output) -> bool where
Self::Output: PartialEq<Self::Output>,
Return true if an element equivalent to target
exists in the array.
sourcefn binary_search(&self, target: &Self::Output) -> Result<usize, usize> where
Self::Output: Ord,
fn binary_search(&self, target: &Self::Output) -> Result<usize, usize> where
Self::Output: Ord,
Perform a binary search for target
.
sourcefn binary_search_by<F>(&self, compare: F) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> Ordering,
fn binary_search_by<F>(&self, compare: F) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> Ordering,
Perform a binary search using a comparator function.
sourcefn binary_search_by_key<K, F>(
&self,
key: &K,
extract: F
) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> K,
K: Ord,
fn binary_search_by_key<K, F>(
&self,
key: &K,
extract: F
) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> K,
K: Ord,
Perform a binary search using a key and a key extractor function.
sourcefn is_sorted(&self) -> bool where
Self::Output: PartialOrd<Self::Output>,
fn is_sorted(&self) -> bool where
Self::Output: PartialOrd<Self::Output>,
Test whether the array is sorted.
sourcefn is_sorted_by<F>(&self, compare: F) -> bool where
F: FnMut(&Self::Output, &Self::Output) -> Option<Ordering>,
fn is_sorted_by<F>(&self, compare: F) -> bool where
F: FnMut(&Self::Output, &Self::Output) -> Option<Ordering>,
Test whether the array is sorted using a comparator function.
sourcefn is_sorted_by_key<K, F>(&self, extract: F) -> bool where
F: FnMut(&Self::Output) -> K,
K: PartialOrd<K>,
fn is_sorted_by_key<K, F>(&self, extract: F) -> bool where
F: FnMut(&Self::Output) -> K,
K: PartialOrd<K>,
Test whether the array is sorted using a key extractor function.
sourceimpl<'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>
sourcefn 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.
sourcefn first_mut(&mut self) -> Option<&mut Self::Output>
fn first_mut(&mut self) -> Option<&mut Self::Output>
Get a mutable reference to the first element in the array.
sourcefn last_mut(&mut self) -> Option<&mut Self::Output>
fn last_mut(&mut self) -> Option<&mut Self::Output>
Get a mutable reference to the last element in the array.
sourcefn set(&mut self, index: usize, value: Self::Output) -> Option<Self::Output> where
Self::Output: Sized,
fn set(&mut self, index: usize, value: Self::Output) -> Option<Self::Output> where
Self::Output: Sized,
Set the value of the element at the given index. Read more
sourcefn swap(&mut self, index1: usize, index2: usize) where
Self::Output: Sized,
fn swap(&mut self, index1: usize, index2: usize) where
Self::Output: Sized,
Swap the elements at two indexes.
sourcefn map_pair<F, A>(&mut self, index1: usize, index2: usize, f: F) -> A where
F: FnMut(&mut Self::Output, &mut Self::Output) -> A,
fn map_pair<F, A>(&mut self, index1: usize, index2: usize, f: F) -> A where
F: FnMut(&mut Self::Output, &mut Self::Output) -> A,
Get mutable references to the elements at two indexes and call a function on them. Read more
sourcefn sort_unstable(&mut self) where
Self::Output: Ord,
Self::Output: Sized,
fn sort_unstable(&mut self) where
Self::Output: Ord,
Self::Output: Sized,
Sort the elements of the array.
sourceimpl<'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>
sourcefn from(buffer: &'a mut RingBuffer<A, N>) -> Self
fn from(buffer: &'a mut RingBuffer<A, N>) -> Self
Converts to this type from the input type.
sourceimpl<'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>
sourceimpl<'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>
sourceimpl<'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>
sourceimpl<'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>
sourceimpl<'a, A: PartialEq + 'a, S, const N: usize> PartialEq<S> for SliceMut<'a, A, N> where
S: Borrow<[A]>,
impl<'a, A: PartialEq + 'a, S, const N: usize> PartialEq<S> for SliceMut<'a, A, N> where
S: Borrow<[A]>,
sourceimpl<A, const N: usize> PartialEq<SliceMut<'_, A, N>> for RingBuffer<A, N> where
A: PartialEq,
impl<A, const N: usize> PartialEq<SliceMut<'_, A, N>> for RingBuffer<A, N> where
A: PartialEq,
sourceimpl<'a, A: PartialEq + 'a, const N: usize> PartialEq<SliceMut<'a, A, N>> for SliceMut<'a, A, N>
impl<'a, A: PartialEq + 'a, const N: usize> PartialEq<SliceMut<'a, A, N>> for SliceMut<'a, A, N>
sourceimpl<'a, A: PartialOrd + 'a, const N: usize> PartialOrd<SliceMut<'a, A, N>> for SliceMut<'a, A, N>
impl<'a, A: PartialOrd + 'a, const N: usize> PartialOrd<SliceMut<'a, A, N>> for SliceMut<'a, A, N>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<'a, A: Eq + 'a, const N: usize> Eq for SliceMut<'a, A, N>
Auto Trait Implementations
impl<'a, A, const N: usize> RefUnwindSafe for SliceMut<'a, A, N> where
A: RefUnwindSafe,
impl<'a, A, const N: usize> Send for SliceMut<'a, A, N> where
A: Send,
impl<'a, A, const N: usize> Sync for SliceMut<'a, A, N> where
A: Sync,
impl<'a, A, const N: usize> Unpin for SliceMut<'a, A, N>
impl<'a, A, const N: usize> !UnwindSafe for SliceMut<'a, A, N>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more