Struct ringbuffer_iteration::RingBuffer[][src]

pub struct RingBuffer<T: Copy + Clone, const N: usize> { /* fields omitted */ }
Expand description

An implementation of a ring buffer data structure that creates a “lossy” queue. This is a simplified version of the generic heapless Queue with a few constraints relaxed:

  • The Item type is at least Copy + Clone
  • We do not care about overwritten data in the buffer. Should be able to write indefinitely without error.

An iterator is also defined for RingBuffer which implements Iterator, ExactSizeIterator, and DoubleEndedIterator. The iterator begins at the head of the ring buffer and iterates until it reaches the tail.

Also uses an internal flag overwriting to allow iteration over the last value in the ring buffer, giving the structure a capacity of N rather than the typical ringbuffer capacity of N-1.

Implementations

Add a new item to the ring buffer.

Pops the last item off of the ring buffer.

Trait Implementations

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.