Struct wasmedge_sys::ImportModule
source · pub struct ImportModule<T: ?Sized + Send + Sync + Clone> { /* private fields */ }
Expand description
An ImportModule represents a host module with a name. A host module consists of one or more host function, table, memory, and global instances, which are defined outside wasm modules and fed into wasm modules as imports.
Implementations§
source§impl<T: ?Sized + Send + Sync + Clone> ImportModule<T>
impl<T: ?Sized + Send + Sync + Clone> ImportModule<T>
sourcepub fn create(
name: impl AsRef<str>,
data: Option<Box<T>>
) -> WasmEdgeResult<Self>
pub fn create( name: impl AsRef<str>, data: Option<Box<T>> ) -> WasmEdgeResult<Self>
Creates a module instance which is used to import host functions, tables, memories, and globals into a wasm module.
Argument
-
name
- The name of the import module instance. -
data
- The host context data used in this function.
Error
If fail to create the import module instance, then an error is returned.
sourcepub fn as_ptr(&self) -> *const WasmEdge_ModuleInstanceContext
Available on crate feature ffi
only.
pub fn as_ptr(&self) -> *const WasmEdge_ModuleInstanceContext
ffi
only.Provides a raw pointer to the inner module instance context.
Trait Implementations§
source§impl<T: ?Sized + Send + Sync + Clone> AsImport for ImportModule<T>
impl<T: ?Sized + Send + Sync + Clone> AsImport for ImportModule<T>
source§fn add_func(&mut self, name: impl AsRef<str>, func: Function)
fn add_func(&mut self, name: impl AsRef<str>, func: Function)
Imports a host function instance. Read more
source§fn add_table(&mut self, name: impl AsRef<str>, table: Table)
fn add_table(&mut self, name: impl AsRef<str>, table: Table)
Imports a table instance. Read more
source§fn add_memory(&mut self, name: impl AsRef<str>, memory: Memory)
fn add_memory(&mut self, name: impl AsRef<str>, memory: Memory)
Imports a memory instance. Read more
source§fn add_global(&mut self, name: impl AsRef<str>, global: Global)
fn add_global(&mut self, name: impl AsRef<str>, global: Global)
Imports a global instance. Read more
source§impl<T: Clone + ?Sized + Send + Sync + Clone> Clone for ImportModule<T>
impl<T: Clone + ?Sized + Send + Sync + Clone> Clone for ImportModule<T>
source§fn clone(&self) -> ImportModule<T>
fn clone(&self) -> ImportModule<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<T> !RefUnwindSafe for ImportModule<T>
impl<T> Send for ImportModule<T>
impl<T> Sync for ImportModule<T>
impl<T> Unpin for ImportModule<T>
impl<T> !UnwindSafe for ImportModule<T>
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