pub struct Module(/* private fields */);Expand description
A TinyWasm WebAssembly Module
This is the internal representation of a WebAssembly module in TinyWasm.
Module are validated before being created, so they are guaranteed to be valid (as long as they were created by TinyWasm).
This means you should not trust a Module created by a third party to be valid.
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 a slice of bytes.
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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Module
impl<'de> Deserialize<'de> for Module
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Module
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin for Module
impl UnwindSafe for Module
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