pub struct Stack { /* private fields */ }Expand description
Stack for the VM with configurable size limit
Implementations§
Source§impl Stack
impl Stack
Sourcepub fn pop(&mut self) -> Result<Value, StackError>
pub fn pop(&mut self) -> Result<Value, StackError>
Pop a value from the stack
Sourcepub fn peek(&self) -> Result<&Value, StackError>
pub fn peek(&self) -> Result<&Value, StackError>
Peek at the top value without removing it
Sourcepub fn peek_n(&self, n: usize) -> Result<&Value, StackError>
pub fn peek_n(&self, n: usize) -> Result<&Value, StackError>
Peek at the nth value from the top (0 = top)
Sourcepub fn dup(&mut self) -> Result<(), StackError>
pub fn dup(&mut self) -> Result<(), StackError>
Duplicate the top value
Sourcepub fn swap(&mut self) -> Result<(), StackError>
pub fn swap(&mut self) -> Result<(), StackError>
Swap the top two values
Sourcepub fn slice_from(&self, bp: usize) -> &[Value]
pub fn slice_from(&self, bp: usize) -> &[Value]
Get a slice of the stack from a base pointer
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stack
impl RefUnwindSafe for Stack
impl Send for Stack
impl Sync for Stack
impl Unpin for Stack
impl UnwindSafe for Stack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more