pub trait Queue<T> {
    fn has_elements(&self) -> bool;
    fn is_full(&self) -> bool;
    fn len(&self) -> usize;
    fn enqueue(&mut self, val: T) -> bool;
    fn push(&mut self, val: T) -> Option<T>;
    fn dequeue(&mut self) -> Option<T>;
    fn empty(&mut self);
    fn retain<F>(&mut self, f: F)
        F: FnMut(&T) -> bool
; }

Required Methods

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.

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.