devela::all

Trait DataDeque

Source
pub trait DataDeque: DataQueue {
    // Required methods
    fn queue_pop_back(
        &mut self,
    ) -> Result<<Self as DataCollection>::Element, NotEnoughElements> ;
    fn queue_push_front(
        &mut self,
        element: <Self as DataCollection>::Element,
    ) -> Result<(), NotEnoughSpace> ;

    // Provided methods
    fn queue_pop_front(
        &mut self,
    ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>  { ... }
    fn queue_push_back(
        &mut self,
        element: <Self as DataCollection>::Element,
    ) -> Result<(), NotEnoughSpace>  { ... }
}
Expand description

An abstract double-ended queue data type.

Required Methods§

Source

fn queue_pop_back( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the back of the queue.

§Errors

Returns NotEnoughElements if there are not enough elements in the queue.

Source

fn queue_push_front( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the front of the queue.

§Errors

Returns NotEnoughSpace if there is not enough free space in the queue.

Provided Methods§

Source

fn queue_pop_front( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the front of the queue (calls queue_pop).

§Errors

Returns NotEnoughElements if there are not enough elements in the queue.

Source

fn queue_push_back( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Remove an element from the back of the queue (calls queue_push).

§Errors

Returns NotEnoughSpace if there is not enough free space in the queue.

Implementors§

Source§

impl<T> DataDeque for VecDeque<T>

Source§

impl<T, const CAP: usize, S: Storage> DataDeque for Destaque<T, CAP, u8, S>

Source§

impl<T, const CAP: usize, S: Storage> DataDeque for Destaque<T, CAP, u16, S>

Source§

impl<T, const CAP: usize, S: Storage> DataDeque for Destaque<T, CAP, u32, S>

Source§

impl<T, const CAP: usize, S: Storage> DataDeque for Destaque<T, CAP, usize, S>