[][src]Struct sized_chunks::ring_buffer::SliceMut

pub struct SliceMut<'a, A, N: ChunkLength<A>> { /* fields omitted */ }

An indexable representation of a mutable subset of a RingBuffer.

Methods

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

#[must_use] pub fn unmut(self) -> Slice<'a, A, N>[src]

Downgrade this slice into a non-mutable slice.

#[must_use] pub fn len(&self) -> usize[src]

Get the length of the slice.

#[must_use] pub fn is_empty(&self) -> bool[src]

Test if the slice is empty.

#[must_use] pub fn get(&self, index: usize) -> Option<&'a A>[src]

Get a reference to the value at a given index.

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

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

#[must_use] pub fn first(&self) -> Option<&A>[src]

Get a reference to the first value in the slice.

#[must_use] pub fn first_mut(&mut self) -> Option<&mut A>[src]

Get a mutable reference to the first value in the slice.

#[must_use] pub fn last(&self) -> Option<&A>[src]

Get a reference to the last value in the slice.

#[must_use] pub fn last_mut(&mut self) -> Option<&mut A>[src]

Get a mutable reference to the last value in the slice.

Important traits for Iter<'a, A, N>
#[must_use] pub fn iter(&self) -> Iter<A, N>[src]

Get an iterator over references to the items in the slice in order.

Important traits for IterMut<'a, A, N>
#[must_use] pub fn iter_mut(&mut self) -> IterMut<A, N>[src]

Get an iterator over mutable references to the items in the slice in order.

#[must_use] pub fn slice<R: RangeBounds<usize>>(self, range: R) -> SliceMut<'a, A, N>[src]

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.

#[must_use] pub fn split_at(self, index: usize) -> (SliceMut<'a, A, N>, SliceMut<'a, A, N>)[src]

Split the slice into two subslices at the given index.

#[must_use] pub fn set(&mut self, index: usize, value: A) -> A[src]

Update the value at index index, returning the old value.

Panics if index is out of bounds.

Important traits for RingBuffer<u8, N>
#[must_use] pub fn to_owned(&self) -> RingBuffer<A, N> where
    A: Clone
[src]

Construct a new RingBuffer by copying the elements in this slice.

Trait Implementations

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

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

impl<'a, A: 'a, N: ChunkLength<A> + 'a> From<&'a mut RingBuffer<A, N>> for SliceMut<'a, A, N>[src]

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

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

type Output = A

The returned type after indexing.

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

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

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

type Item = &'a A

The type of the elements being iterated over.

type IntoIter = Iter<'a, A, N>

Which kind of iterator are we turning this into?

impl<'a, 'b, A: 'a, N: ChunkLength<A> + 'a> IntoIterator for &'a mut SliceMut<'a, A, N>[src]

type Item = &'a mut A

The type of the elements being iterated over.

type IntoIter = IterMut<'a, A, N>

Which kind of iterator are we turning this into?

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

impl<'a, A: PartialEq + 'a, N: ChunkLength<A> + 'a, S> PartialEq<S> for SliceMut<'a, A, N> where
    S: Borrow<[A]>, 
[src]

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

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

Auto Trait Implementations

impl<'a, A, N> RefUnwindSafe for SliceMut<'a, A, N> where
    A: RefUnwindSafe,
    N: RefUnwindSafe,
    <N as ChunkLength<A>>::SizedType: RefUnwindSafe

impl<'a, A, N> Send for SliceMut<'a, A, N> where
    A: Send,
    N: Send,
    <N as ChunkLength<A>>::SizedType: Send

impl<'a, A, N> Sync for SliceMut<'a, A, N> where
    A: Sync,
    N: Sync,
    <N as ChunkLength<A>>::SizedType: Sync

impl<'a, A, N> Unpin for SliceMut<'a, A, N>

impl<'a, A, N> !UnwindSafe for SliceMut<'a, A, N>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.