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 remove_first_matching<F>(&mut self, f: F) -> Option<T>
where F: Fn(&T) -> bool;
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.
sourcefn push(&mut self, val: T) -> Option<T>
fn push(&mut self, val: T) -> Option<T>
Add a new element to the back of the queue, poping one from the front if necessary.
sourcefn remove_first_matching<F>(&mut self, f: F) -> Option<T>
fn remove_first_matching<F>(&mut self, f: F) -> Option<T>
Remove and return one (the first) element that matches the predicate.
Object Safety§
This trait is not object safe.