Struct Stack

Source
pub struct Stack { /* private fields */ }

Implementations§

Source§

impl Stack

Source

pub fn new() -> Stack

Source

pub fn new_with_limit(limit: usize) -> Stack

Source

pub fn len(&self) -> usize

Source

pub fn frame_size(&self) -> usize

How many values are on the current frame

Source

pub fn push_frame(&mut self, params: usize, locals: usize) -> Trap<Frame>

Start a new stack frame by saving the current base pointer.

Source

pub fn reserve_locals(&mut self, locals: usize) -> Trap<()>

Source

pub fn pop_frame(&mut self, old_frame: Frame)

Remove current stack frame and restore previous frame.

Source

pub fn push_params(&mut self, params: &[Value]) -> Trap<usize>

Source

pub fn drop_values(&mut self, count: u32) -> Trap<()>

Source

pub fn tee_local(&mut self, local: LocalIdx) -> Trap<()>

Source

pub fn set_local(&mut self, local: LocalIdx) -> Trap<()>

Source

pub fn get_local(&mut self, local: LocalIdx) -> Trap<()>

Source

pub fn set_local_val(&mut self, local: LocalIdx, val: StackValue)

Source

pub fn get_local_val(&mut self, local: LocalIdx) -> StackValue

Source

pub fn push_val(&mut self, val: StackValue) -> Trap<()>

Source

pub fn pop_typed(&mut self, val_type: ValueType) -> Trap<Value>

Source

pub fn pop_val(&mut self) -> Trap<StackValue>

Source

pub fn top_val(&mut self) -> Trap<StackValue>

Source

pub fn unop<F>(&mut self, op: F) -> Trap<()>
where F: FnOnce(&mut StackValue) -> Trap<()>,

Apply a ‘unop’ to top value, replacing it with the results.

Source

pub fn binop<F>(&mut self, op: F) -> Trap<()>
where F: FnOnce(&mut StackValue, StackValue) -> Trap<()>,

Apply a binop to the top two values, replacing them with the results.

Trait Implementations§

Source§

impl Clone for Stack

Source§

fn clone(&self) -> Stack

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Stack

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Stack

Source§

fn default() -> Stack

Returns the “default value” for a type. Read more
Source§

impl FromStack<f32> for Stack

Source§

fn push(&mut self, val: f32) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<f32>

Source§

fn pop_pair(&mut self) -> Trap<(f32, f32)>

Source§

impl FromStack<f64> for Stack

Source§

fn push(&mut self, val: f64) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<f64>

Source§

fn pop_pair(&mut self) -> Trap<(f64, f64)>

Source§

impl FromStack<i16> for Stack

Source§

fn push(&mut self, val: i16) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<i16>

Source§

fn pop_pair(&mut self) -> Trap<(i16, i16)>

Source§

impl FromStack<i32> for Stack

Source§

fn push(&mut self, val: i32) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<i32>

Source§

fn pop_pair(&mut self) -> Trap<(i32, i32)>

Source§

impl FromStack<i64> for Stack

Source§

fn push(&mut self, val: i64) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<i64>

Source§

fn pop_pair(&mut self) -> Trap<(i64, i64)>

Source§

impl FromStack<i8> for Stack

Source§

fn push(&mut self, val: i8) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<i8>

Source§

fn pop_pair(&mut self) -> Trap<(i8, i8)>

Source§

impl FromStack<u16> for Stack

Source§

fn push(&mut self, val: u16) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<u16>

Source§

fn pop_pair(&mut self) -> Trap<(u16, u16)>

Source§

impl FromStack<u32> for Stack

Source§

fn push(&mut self, val: u32) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<u32>

Source§

fn pop_pair(&mut self) -> Trap<(u32, u32)>

Source§

impl FromStack<u64> for Stack

Source§

fn push(&mut self, val: u64) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<u64>

Source§

fn pop_pair(&mut self) -> Trap<(u64, u64)>

Source§

impl FromStack<u8> for Stack

Source§

fn push(&mut self, val: u8) -> Trap<()>

Source§

fn pop(&mut self) -> Trap<u8>

Source§

fn pop_pair(&mut self) -> Trap<(u8, u8)>

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.