pub trait DataQueue: DataCollection {
// Required methods
fn queue_pop(
&mut self,
) -> Result<<Self as DataCollection>::Element, NotEnoughElements> ⓘ;
fn queue_push(
&mut self,
element: <Self as DataCollection>::Element,
) -> Result<(), NotEnoughSpace> ⓘ;
}
Expand description
An abstract queue data type.
Required Methods§
Sourcefn queue_pop(
&mut self,
) -> Result<<Self as DataCollection>::Element, NotEnoughElements> ⓘ
fn queue_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements> ⓘ
Remove an element from the (front of the) queue.
§Errors
Returns NotEnoughElements
if there are not enough elements in the queue.
Sourcefn queue_push(
&mut self,
element: <Self as DataCollection>::Element,
) -> Result<(), NotEnoughSpace> ⓘ
fn queue_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace> ⓘ
Add an element to the (back of the) queue.
§Errors
Returns NotEnoughSpace
if there is not enough free space in the queue.