Trait kernel::collections::queue::Queue
source · pub trait Queue<T> {
// Required methods
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)
where F: FnMut(&T) -> bool;
}
Required Methods§
sourcefn has_elements(&self) -> bool
fn has_elements(&self) -> bool
Returns true if there are any items in the queue, false otherwise.
sourcefn enqueue(&mut self, val: T) -> bool
fn enqueue(&mut self, val: T) -> bool
If the queue isn’t full, add a new element to the back of the queue. Returns whether the element was added.