pub trait DataStack: DataCollection {
// Required methods
fn stack_pop(
&mut self,
) -> Result<<Self as DataCollection>::Element, NotEnoughElements> ⓘ;
fn stack_push(
&mut self,
element: <Self as DataCollection>::Element,
) -> Result<(), NotEnoughSpace> ⓘ;
}
Expand description
An abstract stack data type.
Required Methods§
Sourcefn stack_pop(
&mut self,
) -> Result<<Self as DataCollection>::Element, NotEnoughElements> ⓘ
fn stack_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements> ⓘ
Remove an element from the (back of the) stack.
Sourcefn stack_push(
&mut self,
element: <Self as DataCollection>::Element,
) -> Result<(), NotEnoughSpace> ⓘ
fn stack_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace> ⓘ
Add an element to the (back of the) stack.