pub struct Module(/* private fields */);Expand description
TinyWasm’s parsed and lowered representation of a WebAssembly module.
Modules produced by the parser are validated by default, but validation can be disabled for trusted input. Do not trust modules or archives from third parties.
See https://webassembly.github.io/spec/core/syntax/modules.html#syntax-module
Implementations§
Source§impl Module
impl Module
Sourcepub fn try_from_twasm(wasm: &[u8]) -> Result<Self, TwasmError>
pub fn try_from_twasm(wasm: &[u8]) -> Result<Self, TwasmError>
Creates a Module from internal twasm archive bytes.
Archives are version-specific and are not validated as untrusted input. Only load archives from a trusted source.
Sourcepub fn serialize_twasm(&self) -> Result<Vec<u8>, TwasmError>
pub fn serialize_twasm(&self) -> Result<Vec<u8>, TwasmError>
Serializes the Module into a vector of bytes.
Source§impl Module
impl Module
Sourcepub fn imports(&self) -> impl Iterator<Item = ModuleImport<'_>>
pub fn imports(&self) -> impl Iterator<Item = ModuleImport<'_>>
Returns an iterator over the module’s import descriptors.
The returned data mirrors the module’s import section and preserves order.
Sourcepub fn exports(&self) -> impl Iterator<Item = ModuleExport<'_>>
pub fn exports(&self) -> impl Iterator<Item = ModuleExport<'_>>
Returns an iterator over the module’s export descriptors.
The returned data mirrors the module’s export section and preserves order.