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

Push an item to the top of the stack, returning a new stack

Pop the top element of the stack. Returns an Option on a T and a new Stack to replace this.

Peek at the top item of the stack.

Returns Some if there is an item on top of the stack, and None if the stack is empty.

Returns an empty stack.

Implementors