[][src]Struct kernel::common::ring_buffer::RingBuffer

pub struct RingBuffer<'a, T: 'a> { /* fields omitted */ }

Implementations

impl<'a, T: Copy> RingBuffer<'a, T>[src]

pub fn new(ring: &'a mut [T]) -> RingBuffer<'a, T>[src]

pub fn available_len(&self) -> usize[src]

Returns the number of elements that can be enqueued until the ring buffer is full.

pub fn as_slices(&'a self) -> (Option<&'a [T]>, Option<&'a [T]>)[src]

Returns up to 2 slices that together form the contents of the ring buffer.

Returns:

  • (None, None) if the buffer is empty.
  • (Some(slice), None) if the head is before the tail (therefore all the contents is contiguous).
  • (Some(left), Some(right)) if the head is after the tail. In that case, the logical contents of the buffer is [left, right].concat() (although physically the "left" slice is stored after the "right" slice).

Trait Implementations

impl<'_, T: Copy> Queue<T> for RingBuffer<'_, T>[src]

Auto Trait Implementations

impl<'a, T> Send for RingBuffer<'a, T> where
    T: Send

impl<'a, T> Sync for RingBuffer<'a, T> where
    T: Sync

impl<'a, T> Unpin for RingBuffer<'a, T>

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, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

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.