pub trait AsInstance {
Show 17 methods
// Required method
unsafe fn as_ptr(&self) -> *const WasmEdge_ModuleInstanceContext;
// Provided methods
fn name(&self) -> Option<String> { ... }
fn get_table(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Table, &Self>>
where Self: Sized { ... }
fn get_memory_ref(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Memory, &Self>>
where Self: Sized { ... }
fn get_memory_mut(
&mut self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Memory, &mut Self>>
where Self: Sized { ... }
fn get_global(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Global, &Self>>
where Self: Sized { ... }
fn get_global_mut(
&mut self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Global, &mut Self>>
where Self: Sized { ... }
fn func_len(&self) -> u32 { ... }
fn func_names(&self) -> Option<Vec<String>> { ... }
fn get_func(&self, name: &str) -> WasmEdgeResult<FuncRef<&Instance>> { ... }
fn get_func_mut(
&mut self,
name: &str,
) -> WasmEdgeResult<FuncRef<&mut Instance>> { ... }
fn table_len(&self) -> u32 { ... }
fn table_names(&self) -> Option<Vec<String>> { ... }
fn mem_len(&self) -> u32 { ... }
fn mem_names(&self) -> Option<Vec<String>> { ... }
fn global_len(&self) -> u32 { ... }
fn global_names(&self) -> Option<Vec<String>> { ... }
}Expand description
The object as an module instance is required to implement this trait.
Required Methods§
Sourceunsafe fn as_ptr(&self) -> *const WasmEdge_ModuleInstanceContext
unsafe fn as_ptr(&self) -> *const WasmEdge_ModuleInstanceContext
§Safety
Provides a raw pointer to the inner module instance context. The lifetime of the returned pointer must not exceed that of the object itself.
Provided Methods§
Sourcefn name(&self) -> Option<String>
fn name(&self) -> Option<String>
Returns the name of this exported module instance.
If this module instance is an active module instance, then None is returned.
Sourcefn get_table(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Table, &Self>>where
Self: Sized,
fn get_table(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Table, &Self>>where
Self: Sized,
Returns the exported table instance by name.
§Argument
name- The name of the target exported table instance.
§Error
If fail to find the target table instance, then an error is returned.
Sourcefn get_memory_ref(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Memory, &Self>>where
Self: Sized,
fn get_memory_ref(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Memory, &Self>>where
Self: Sized,
Returns the exported memory instance by name.
§Argument
name- The name of the target exported memory instance.
§Error
If fail to find the target memory instance, then an error is returned.
fn get_memory_mut(
&mut self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Memory, &mut Self>>where
Self: Sized,
Sourcefn get_global(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Global, &Self>>where
Self: Sized,
fn get_global(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Global, &Self>>where
Self: Sized,
Returns the exported global instance by name.
§Argument
name- The name of the target exported global instance.
§Error
If fail to find the target global instance, then an error is returned.
fn get_global_mut(
&mut self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Global, &mut Self>>where
Self: Sized,
Sourcefn func_len(&self) -> u32
fn func_len(&self) -> u32
Returns the length of the exported function instances in this module instance.
Sourcefn func_names(&self) -> Option<Vec<String>>
fn func_names(&self) -> Option<Vec<String>>
Returns the names of the exported function instances in this module instance.
Sourcefn get_func(&self, name: &str) -> WasmEdgeResult<FuncRef<&Instance>>
fn get_func(&self, name: &str) -> WasmEdgeResult<FuncRef<&Instance>>
Returns the exported function instance by name.
§Argument
name- The name of the target exported function instance.
§Error
If fail to find the target function, then an error is returned.
Sourcefn get_func_mut(&mut self, name: &str) -> WasmEdgeResult<FuncRef<&mut Instance>>
fn get_func_mut(&mut self, name: &str) -> WasmEdgeResult<FuncRef<&mut Instance>>
Returns the exported function instance by name.
§Argument
name- The name of the target exported function instance.
§Error
If fail to find the target function, then an error is returned.
Sourcefn table_len(&self) -> u32
fn table_len(&self) -> u32
Returns the length of the exported table instances in this module instance.
Sourcefn table_names(&self) -> Option<Vec<String>>
fn table_names(&self) -> Option<Vec<String>>
Returns the names of the exported table instances in this module instance.
Sourcefn mem_len(&self) -> u32
fn mem_len(&self) -> u32
Returns the length of the exported memory instances in this module instance.
Sourcefn mem_names(&self) -> Option<Vec<String>>
fn mem_names(&self) -> Option<Vec<String>>
Returns the names of all exported memory instances in this module instance.
Sourcefn global_len(&self) -> u32
fn global_len(&self) -> u32
Returns the length of the exported global instances in this module instance.
Sourcefn global_names(&self) -> Option<Vec<String>>
fn global_names(&self) -> Option<Vec<String>>
Returns the names of the exported global instances in this module instance.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl AsInstance for Instance
impl<Inst> AsInstance for Inst
impl<T: Send> AsInstance for AsyncImportObject<T>
async only.