pub struct ModuleData { /* private fields */ }Expand description
A data structure intended to hold a parsed representation of the wasm interface types of a module.
The expected usage pattern is to create this next to wasmtime data structures and then use this to process arguments into wasm arguments as appropriate for bound functions.
Implementations§
Source§impl ModuleData
impl ModuleData
Sourcepub fn new(wasm: &[u8]) -> Result<ModuleData>
pub fn new(wasm: &[u8]) -> Result<ModuleData>
Parses a raw binary wasm file, extracting information about wasm interface types.
Returns an error if the wasm file is malformed.
Sourcepub fn find_wasi_module_name(&self) -> Option<String>
pub fn find_wasi_module_name(&self) -> Option<String>
Detects if WASI support is needed: returns module name that is requested.
Sourcepub fn invoke_export(
&self,
instance: &Instance,
export: &str,
args: &[Value],
) -> Result<Vec<Value>>
pub fn invoke_export( &self, instance: &Instance, export: &str, args: &[Value], ) -> Result<Vec<Value>>
Invokes wasmtime function with a &[Value] list. Value the set of
wasm interface types.
Sourcepub fn binding_for_export(
&self,
instance: &mut InstanceHandle,
name: &str,
) -> Result<ExportBinding<'_>>
pub fn binding_for_export( &self, instance: &mut InstanceHandle, name: &str, ) -> Result<ExportBinding<'_>>
Returns an appropriate binding for the name export in this module
which has also been instantiated as instance provided here.
Returns an error if name is not present in the module.
Auto Trait Implementations§
impl Freeze for ModuleData
impl !RefUnwindSafe for ModuleData
impl Send for ModuleData
impl Sync for ModuleData
impl Unpin for ModuleData
impl !UnwindSafe for ModuleData
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more