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: Into<Self::Value>>(&mut self, v: T);
    fn stack_pop(&mut self) -> Result<Self::Value>;
    fn stack_get(&self, pos: usize) -> Result<&Self::Value>;
    fn stack_get_mut(&mut self, pos: usize) -> Result<&mut Self::Value>;
    fn stack_len(&self) -> usize;

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

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: Into<Self::Value>>(&mut self, v: T)

Source

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

Source

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

Source

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

Source

fn stack_len(&self) -> usize

Provided Methods§

Source

fn stack_is_empty(&self) -> bool

Source

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

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§