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§
Sourcefn queue_pop_back(
&mut self,
) -> Result<<Self as DataCollection>::Element, NotEnoughElements> ⓘ
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.
Sourcefn queue_push_front(
&mut self,
element: <Self as DataCollection>::Element,
) -> Result<(), NotEnoughSpace> ⓘ
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§
Sourcefn queue_pop_front(
&mut self,
) -> Result<<Self as DataCollection>::Element, NotEnoughElements> ⓘ
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.
Sourcefn queue_push_back(
&mut self,
element: <Self as DataCollection>::Element,
) -> Result<(), NotEnoughSpace> ⓘ
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.