Queue

Type Alias Queue 

Source
pub type Queue<T> = VecDeque<T>;
Expand description

§FIFO

This sequencer is used for the BFS (Breadth-First-Search) algorithm.

Aliased Type§

pub struct Queue<T> { /* private fields */ }

Trait Implementations§

Source§

impl<T> NodeSequencer<T> for Queue<T>

Source§

fn is_ordered(&self) -> bool

Returns true if the sequence is ordered and minimum/maximum matter.
Source§

fn init(item: T) -> Self

Initializes the sequencer with a starting object as the first element.
Source§

fn push(&mut self, item: T)

Pushes a given element onto the sequencer.
Source§

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

Pops the highest-order-priority element from the sequencer and returns it as an Option<T>. Returns None if the sequencer was empty.
Source§

fn len(&self) -> usize

Returns the number of elements in the sequencer.
Source§

fn to_vec(self) -> Vec<T>

Consumes the sequencer and returns a Vec<T> with all remaining objects in the sequencer.
Source§

fn from_vec(items: Vec<T>) -> Self

Creates a sequencer from a Vec<T>. Note that elements will most likely be pushed into the sequencer in the given order in the vector.
Source§

fn is_empty(&self) -> bool

Returns true if the length is zero
Source§

fn convert_from<S>(other: S) -> Self
where S: NodeSequencer<T>,

Consumes a foreign sequencer to create a new sequencer of this type. Read more
Source§

fn pop_until_satisfied<F>(&mut self, f: F) -> Option<T>
where F: Fn(&T) -> bool,

Keeps popping elements from the sequencer until a condition is met or the sequencer is empty.