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 { ... }
}
Expand description
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
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.