pub trait Stackable {
type Item;
// Required methods
fn is_empty(&self) -> bool;
fn as_slice(&self) -> &[Self::Item];
fn push(&mut self, item: Self::Item);
fn pop1(&mut self) -> Option<Self::Item>;
fn pop(&mut self, n: usize) -> Option<Vec<Self::Item>>;
fn peek1(&self) -> Option<&Self::Item>;
}Expand description
The Stackable trait represents a small basic set of operations
required by the interpreter.
Required Associated Types§
Required Methods§
Sourcefn pop1(&mut self) -> Option<Self::Item>
fn pop1(&mut self) -> Option<Self::Item>
Removes the last item of the stack and returns it, None if
the stack is empty.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".