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§
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>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".