Skip to main content

StackMemory

Trait StackMemory 

Source
pub trait StackMemory {
    type Value;

    // Required methods
    fn stack(&self) -> &Vec<Self::Value>;
    fn stack_mut(&mut self) -> &mut Vec<Self::Value>;
    fn stack_push<T>(&mut self, v: T)
       where T: Into<Self::Value>;
    fn stack_pop(&mut self) -> Result<Self::Value, Report>;
    fn stack_get(&self, pos: usize) -> Result<&Self::Value, Report>;
    fn stack_get_mut(&mut self, pos: usize) -> Result<&mut Self::Value, Report>;
    fn stack_len(&self) -> usize;

    // Provided methods
    fn stack_is_empty(&self) -> bool { ... }
    fn stack_top(&self) -> Result<&Self::Value, Report> { ... }
    fn stack_top_mut(&mut self) -> Result<&mut Self::Value, Report> { ... }
}

Required Associated Types§

Required Methods§

Source

fn stack(&self) -> &Vec<Self::Value>

Source

fn stack_mut(&mut self) -> &mut Vec<Self::Value>

Source

fn stack_push<T>(&mut self, v: T)
where T: Into<Self::Value>,

Source

fn stack_pop(&mut self) -> Result<Self::Value, Report>

Source

fn stack_get(&self, pos: usize) -> Result<&Self::Value, Report>

Source

fn stack_get_mut(&mut self, pos: usize) -> Result<&mut Self::Value, Report>

Source

fn stack_len(&self) -> usize

Provided Methods§

Source

fn stack_is_empty(&self) -> bool

Source

fn stack_top(&self) -> Result<&Self::Value, Report>

Source

fn stack_top_mut(&mut self) -> Result<&mut Self::Value, Report>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§