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

Implementations

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

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

Returns true if there are any items in the queue, false otherwise.

Returns true if the queue is full, false otherwise.

Returns how many elements are in the queue.

If the queue isn’t full, add a new element to the back of the queue. Returns whether the element was added. Read more

Add a new element to the back of the queue, poping one from the front if necessary.

Remove the element from the front of the queue.

Remove all elements from the ring buffer.

Retains only the elements that satisfy the predicate.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.