Trait seax_util::list::Stack
[−]
[src]
pub trait Stack<T>: Sized { fn push(self, item: T) -> Self; fn pop(self) -> Option<(T, Self)>; fn peek(&self) -> Option<&T>; fn empty() -> Self; }
Common functions for an immutable Stack abstract data type.
Required Methods
fn push(self, item: T) -> Self
Push an item to the top of the stack, returning a new stack
fn pop(self) -> Option<(T, Self)>
Pop the top element of the stack. Returns an Option on a T and
a new Stack
fn peek(&self) -> Option<&T>
Peek at the top item of the stack.
Returns Some
fn empty() -> Self
Returns an empty stack.
Implementors
impl<T> Stack<T> for List<T>