pub trait BidirectedQueue<T>: Default {
    // Required methods
    fn push_front(&mut self, t: T);
    fn push_back(&mut self, t: T);
    fn pop_front(&mut self) -> Option<T>;
    fn pop_back(&mut self) -> Option<T>;
    fn clear(&mut self);
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A queue that supports both popping and pushing at front and back.

Required Methods§

source

fn push_front(&mut self, t: T)

Insert an element at the front of the queue.

source

fn push_back(&mut self, t: T)

Insert an element at the back of the queue.

source

fn pop_front(&mut self) -> Option<T>

Remove and return an element from the front of the queue.

source

fn pop_back(&mut self) -> Option<T>

Remove and return an element from the back of the queue.

source

fn clear(&mut self)

Remove all elements from the queue without returning them.

source

fn len(&self) -> usize

Return the amount of elements currently in the queue.

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if the queue contains no elements.

Implementations on Foreign Types§

source§

impl<T> BidirectedQueue<T> for VecDeque<T>

source§

fn push_front(&mut self, t: T)

source§

fn push_back(&mut self, t: T)

source§

fn pop_front(&mut self) -> Option<T>

source§

fn pop_back(&mut self) -> Option<T>

source§

fn clear(&mut self)

source§

fn len(&self) -> usize

source§

impl<T> BidirectedQueue<T> for LinkedList<T>

source§

fn push_front(&mut self, t: T)

source§

fn push_back(&mut self, t: T)

source§

fn pop_front(&mut self) -> Option<T>

source§

fn pop_back(&mut self) -> Option<T>

source§

fn clear(&mut self)

source§

fn len(&self) -> usize

Implementors§