pub struct Module { /* private fields */ }
Expand description
Defines compiled in-memory representation of an input WASM binary.
A Module is a compiled in-memory representation of an input WebAssembly binary. In the instantiation process, a Module is instatiated to a module instance, from which the exported function, table, memory, and global instances can be fetched.
Implementations§
Source§impl Module
impl Module
Sourcepub fn from_bytes(
config: Option<&Config>,
bytes: impl AsRef<[u8]>,
) -> WasmEdgeResult<Self>
pub fn from_bytes( config: Option<&Config>, bytes: impl AsRef<[u8]>, ) -> WasmEdgeResult<Self>
Sourcepub fn count_of_imports(&self) -> u32
pub fn count_of_imports(&self) -> u32
Returns the count of the imported WasmEdge instances in the module.
Sourcepub fn imports(&self) -> Vec<ImportType<'_>>
pub fn imports(&self) -> Vec<ImportType<'_>>
Returns the import types of all imported WasmEdge instances in the module.
Sourcepub fn count_of_exports(&self) -> u32
pub fn count_of_exports(&self) -> u32
Returns the count of the exported WasmEdge instances from the module.
Sourcepub fn exports(&self) -> Vec<ExportType<'_>>
pub fn exports(&self) -> Vec<ExportType<'_>>
Returns the export types of all exported WasmEdge instances (including funcs, tables, globals and memories) from the module.
Sourcepub fn get_export(&self, name: impl AsRef<str>) -> Option<ExternalInstanceType>
pub fn get_export(&self, name: impl AsRef<str>) -> Option<ExternalInstanceType>
Gets the export type by the name of a specific exported WasmEdge instance, such as func, table, global or memory instance.
§Argument
name
- The name of the target exported WasmEdge instance, such as func, table, global or memory instance.