pub trait ContainerQueue<C: Container> {
    // Required methods
    fn next_or_alloc(&mut self) -> Result<C::Item<'_>, C>;
    fn is_empty(&self) -> bool;
    fn cmp_heads(&self, other: &Self) -> Ordering;
    fn from(container: C) -> Self;
}
Expand description

An abstraction for a container that can be iterated over, and conclude by returning itself.

Required Methods§

Source

fn next_or_alloc(&mut self) -> Result<C::Item<'_>, C>

Returns either the next item in the container, or the container itself.

Source

fn is_empty(&self) -> bool

Indicates whether next_or_alloc will return Ok, and whether peek will return Some.

Source

fn cmp_heads(&self, other: &Self) -> Ordering

Compare the heads of two queues, where empty queues come last.

Source

fn from(container: C) -> Self

Create a new queue from an existing container.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<D: Ord, T: Ord, R> ContainerQueue<Vec<(D, T, R)>> for VecDeque<(D, T, R)>

Source§

fn next_or_alloc(&mut self) -> Result<(D, T, R), Vec<(D, T, R)>>

Source§

fn is_empty(&self) -> bool

Source§

fn cmp_heads(&self, other: &Self) -> Ordering

Source§

fn from(list: Vec<(D, T, R)>) -> Self

Implementors§