[][src]Struct runestick::Stack

pub struct Stack { /* fields omitted */ }

The stack of the virtual machine, where all values are stored.

Implementations

impl Stack[src]

pub const fn new() -> Self[src]

Construct a new stack.

pub fn extend<I>(&mut self, iter: I) where
    I: IntoIterator<Item = Value>, 
[src]

Extend the current stack.

pub fn stack_bottom(&self) -> usize[src]

Get the offset that corresponds to the top of the stack right now.

pub fn with_capacity(capacity: usize) -> Self[src]

Construct a new stack with the given capacity.

pub fn clear(&mut self)[src]

Clear the current stack.

pub fn get<I>(&self, index: I) -> Option<&<I as SliceIndex<[Value]>>::Output> where
    I: SliceIndex<[Value]>, 
[src]

Get the given slice of the stack, if it isn't out of range.

pub fn peek(&mut self) -> Option<&Value>[src]

Peek the top of the stack.

pub fn last(&self) -> Result<&Value, StackError>[src]

Get the last position on the stack.

pub fn at_offset(&self, offset: usize) -> Result<&Value, StackError>[src]

Access the value at the given frame offset.

pub fn at_offset_from_top(&self, offset: usize) -> Result<&Value, StackError>[src]

Peek the value at the given offset from the top.

pub fn at_offset_mut(&mut self, offset: usize) -> Result<&mut Value, StackError>[src]

Get the offset at the given location.

pub fn push<T>(&mut self, value: T) where
    Value: From<T>, 
[src]

Push a value onto the stack.

pub fn pop(&mut self) -> Result<Value, StackError>[src]

Pop a reference to a value from the stack.

pub fn popn(&mut self, count: usize) -> Result<(), StackError>[src]

Pop the given number of elements from the stack.

pub fn is_empty(&self) -> bool[src]

Test if the stack is empty.

pub fn len(&self) -> usize[src]

Get the length of the stack.

pub fn iter(&self) -> impl Iterator<Item = &Value> + '_[src]

Iterate over the stack.

pub fn pop_sequence(&mut self, count: usize) -> Result<Vec<Value>, StackError>[src]

Pop a sequence of values from the stack.

pub fn drain_stack_top(
    &mut self,
    count: usize
) -> Result<impl DoubleEndedIterator<Item = Value> + '_, StackError>
[src]

Drain the top count elements of the stack in the order that they were pushed, from bottom to top.

Trait Implementations

impl Clone for Stack[src]

impl Debug for Stack[src]

impl From<Vec<Value>> for Stack[src]

impl FromIterator<Value> for Stack[src]

Auto Trait Implementations

impl !RefUnwindSafe for Stack

impl !Send for Stack

impl !Sync for Stack

impl Unpin for Stack

impl !UnwindSafe for Stack

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.