pub trait Stack {
    type Item;

    // Required methods
    fn try_push(&mut self, elem: Self::Item) -> bool;
    fn pop(&mut self) -> Option<Self::Item>;
    fn get(&self) -> Option<&Self::Item>;
    fn get_mut(&mut self) -> Option<&mut Self::Item>;
    fn is_empty(&self) -> bool;
}
Expand description

A trait defining a Stack datastructure.

Any such datastructure can be used to store the iterators for Streaming::inner_combinations. Is implemented for Vec

Required Associated Types§

source

type Item

The type of items the stack holds

Required Methods§

source

fn try_push(&mut self, elem: Self::Item) -> bool

try to push to the stack, indicate success. This may fail, e.g. for a limited buffer.

source

fn pop(&mut self) -> Option<Self::Item>

pop from the stack.

source

fn get(&self) -> Option<&Self::Item>

get a reference to the top element

source

fn get_mut(&mut self) -> Option<&mut Self::Item>

get a mutable reference to the top element

source

fn is_empty(&self) -> bool

indicate if the stack is empty.

Stack::pop, Stack::get and Stack::get_mut should return None exactly if this returns true.

Implementations on Foreign Types§

source§

impl<T> Stack for Vec<T>

§

type Item = T

source§

fn try_push(&mut self, elem: T) -> bool

source§

fn pop(&mut self) -> Option<T>

source§

fn get(&self) -> Option<&T>

source§

fn get_mut(&mut self) -> Option<&mut T>

source§

fn is_empty(&self) -> bool

Implementors§