pub struct RuntimeInstance<'b, H = EmptyHookSet>{
pub hook_set: H,
pub store: Option<Store<'b>>,
}
Fields§
§hook_set: H
§store: Option<Store<'b>>
Implementations§
Source§impl<'b> RuntimeInstance<'b, EmptyHookSet>
impl<'b> RuntimeInstance<'b, EmptyHookSet>
pub fn new(validation_info: &ValidationInfo<'b>) -> CustomResult<Self>
pub fn new_named( module_name: &str, validation_info: &ValidationInfo<'b>, ) -> CustomResult<Self>
Source§impl<'b, H> RuntimeInstance<'b, H>
impl<'b, H> RuntimeInstance<'b, H>
pub fn add_module( &mut self, module_name: &str, validation_info: &ValidationInfo<'b>, ) -> CustomResult<()>
pub fn new_with_hooks( module_name: &str, validation_info: &ValidationInfo<'b>, hook_set: H, ) -> CustomResult<Self>
pub fn get_function_by_name( &self, module_name: &str, function_name: &str, ) -> Result<FunctionRef, RuntimeError>
pub fn get_function_by_index( &self, module_addr: usize, function_idx: usize, ) -> Result<FunctionRef, RuntimeError>
pub fn invoke<Param: InteropValueList, Returns: InteropValueList>( &mut self, function_ref: &FunctionRef, params: Param, ) -> Result<Returns, RuntimeError>
Sourcepub fn invoke_dynamic(
&mut self,
function_ref: &FunctionRef,
params: Vec<Value>,
ret_types: &[ValType],
) -> Result<Vec<Value>, RuntimeError>
pub fn invoke_dynamic( &mut self, function_ref: &FunctionRef, params: Vec<Value>, ret_types: &[ValType], ) -> Result<Vec<Value>, RuntimeError>
Invokes a function with the given parameters, and return types which are not known at compile time.
Sourcepub fn invoke_dynamic_unchecked_return_ty(
&mut self,
function_ref: &FunctionRef,
params: Vec<Value>,
) -> Result<Vec<Value>, RuntimeError>
pub fn invoke_dynamic_unchecked_return_ty( &mut self, function_ref: &FunctionRef, params: Vec<Value>, ) -> Result<Vec<Value>, RuntimeError>
Get the indicies of a module and function by their names.
§Arguments
module_name
: The module in which to find the function.function_name
: The name of the function to find inside the module. The function must be a local function and not an import.
§Returns
Ok((module_idx, func_idx))
, wheremodule_idx
is the internal index of the module inside the RuntimeInstance, andfunc_idx
is the internal index of the function inside the module.Err(RuntimeError::ModuleNotFound)
, if the module is not found.Err(RuntimeError::FunctionNotFound
, if the function is not found within the module.
Trait Implementations§
Auto Trait Implementations§
impl<'b, H> Freeze for RuntimeInstance<'b, H>where
H: Freeze,
impl<'b, H = EmptyHookSet> !RefUnwindSafe for RuntimeInstance<'b, H>
impl<'b, H> Send for RuntimeInstance<'b, H>where
H: Send,
impl<'b, H = EmptyHookSet> !Sync for RuntimeInstance<'b, H>
impl<'b, H> Unpin for RuntimeInstance<'b, H>where
H: Unpin,
impl<'b, H> UnwindSafe for RuntimeInstance<'b, H>where
H: UnwindSafe,
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