Struct Runtime

Source
pub struct Runtime<'module, 'source, I: Importer> { /* private fields */ }

Implementations§

Source§

impl<'m, 's, I: Importer> Runtime<'m, 's, I>

Source

pub fn instantiate(module: &'m Module<'s>, importer: I) -> Result<Self>

Initialize states of execution (stack, memory, …) and instantiate a given module. It means that ‘start function’ is invoked in this function if presents. The module is assumed to be validated. If an invalid module is given, the behavior is unspecified, meaning that it may crash or the result may be incorrect.

https://webassembly.github.io/spec/core/exec/modules.html#instantiation

Source

pub fn module(&self) -> &'m Module<'s>

Source

pub fn memory(&self) -> &Memory

Source

pub fn get_global(&self, name: &str) -> Option<Value>

Source

pub fn invoke( &mut self, name: impl AsRef<str>, args: &[Value], ) -> Result<Option<Value>>

Auto Trait Implementations§

§

impl<'module, 'source, I> Freeze for Runtime<'module, 'source, I>
where I: Freeze,

§

impl<'module, 'source, I> RefUnwindSafe for Runtime<'module, 'source, I>
where I: RefUnwindSafe,

§

impl<'module, 'source, I> Send for Runtime<'module, 'source, I>
where I: Send,

§

impl<'module, 'source, I> Sync for Runtime<'module, 'source, I>
where I: Sync,

§

impl<'module, 'source, I> Unpin for Runtime<'module, 'source, I>
where I: Unpin,

§

impl<'module, 'source, I> UnwindSafe for Runtime<'module, 'source, I>
where I: UnwindSafe,

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> 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, 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.