Struct ModuleInstance

Source
pub struct ModuleInstance { /* private fields */ }
Expand description

Module instance.

Implementations§

Source§

impl ModuleInstance

Source

pub fn new<'a>( program: Weak<ProgramInstanceEssence>, name: String, module: Module, ) -> Result<Self, Error>

Instantiate given module within program context.

Source

pub fn instantiate<'a>( &mut self, externals: Option<&'a HashMap<String, Arc<dyn ModuleInstanceInterface + 'a>>>, ) -> Result<(), Error>

Run instantiation-time procedures (validation). Module is not completely validated until this call.

Source

pub fn run_start_function(&self) -> Result<(), Error>

Run start function [if any].

Trait Implementations§

Source§

impl ModuleInstanceInterface for ModuleInstance

Source§

fn execute_index( &self, index: u32, params: ExecutionParams<'_>, ) -> Result<Option<RuntimeValue>, Error>

Execute function with the given index.
Source§

fn execute_export( &self, name: &str, params: ExecutionParams<'_>, ) -> Result<Option<RuntimeValue>, Error>

Execute function with the given export name.
Source§

fn export_entry<'a>( &self, name: &str, required_type: &ExportEntryType<'_>, ) -> Result<Internal, Error>

Get export entry.
Source§

fn table(&self, index: ItemIndex) -> Result<Arc<TableInstance>, Error>

Get table reference.
Source§

fn memory(&self, index: ItemIndex) -> Result<Arc<MemoryInstance>, Error>

Get memory reference.
Source§

fn global<'a>( &self, index: ItemIndex, variable_type: Option<VariableType>, externals: Option<&'a HashMap<String, Arc<dyn ModuleInstanceInterface + 'a>>>, ) -> Result<Arc<VariableInstance>, Error>

Get global reference.
Source§

fn function_type( &self, function_index: ItemIndex, ) -> Result<FunctionSignature<'_>, Error>

Get function type for given function index.
Source§

fn function_type_by_index( &self, type_index: u32, ) -> Result<FunctionSignature<'_>, Error>

Get function type for given function index.
Source§

fn function_reference<'a>( &self, index: ItemIndex, externals: Option<&'a HashMap<String, Arc<dyn ModuleInstanceInterface + 'a>>>, ) -> Result<InternalFunctionReference<'a>, Error>

Get function reference.
Source§

fn function_reference_indirect<'a>( &self, table_idx: u32, type_idx: u32, func_idx: u32, externals: Option<&'a HashMap<String, Arc<dyn ModuleInstanceInterface + 'a>>>, ) -> Result<InternalFunctionReference<'a>, Error>

Get function indirect reference.
Source§

fn function_body<'a>( &'a self, internal_index: u32, ) -> Result<Option<InternalFunction<'a>>, Error>

Get internal function for interpretation.
Source§

fn call_internal_function( &self, outer: CallerContext<'_>, index: u32, ) -> Result<Option<RuntimeValue>, Error>

Call function with given internal index.

Auto Trait Implementations§

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.
Source§

impl<T> Erased for T