Trait ringbuffer::RingBuffer[][src]

pub trait RingBuffer<T>: Sized {
    fn len(&self) -> usize;
fn capacity(&self) -> usize; fn is_empty(&self) -> bool { ... }
fn is_full(&self) -> bool { ... } }

RingBuffer is a trait defining the standard interface for all RingBuffer implementations (AllocRingBuffer, ConstGenericRingBuffer)

This trait is not object safe, so can’t be used dynamically. However it is possible to define a generic function over types implementing RingBuffer.

Most actual functionality of ringbuffers is contained in the extension traits RingBufferExt, RingBufferRead and RingBufferWrite

Required methods

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

Returns the length of the internal buffer. This length grows up to the capacity and then stops growing. This is because when the length is reached, new items are appended at the start.

fn capacity(&self) -> usize[src]

Returns the capacity of the buffer.

Loading content...

Provided methods

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

Returns true if the buffer is entirely empty.

fn is_full(&self) -> bool[src]

Returns true when the length of the ringbuffer equals the capacity. This happens whenever more elements than capacity have been pushed to the buffer.

Loading content...

Implementors

impl<T> RingBuffer<T> for AllocRingBuffer<T>[src]

impl<T, const CAP: usize> RingBuffer<T> for ConstGenericRingBuffer<T, CAP>[src]

Loading content...