pub struct Module { /* private fields */ }
Expand description
A WebAssembly Module
See https://webassembly.github.io/spec/core/syntax/modules.html#syntax-module
Implementations§
source§impl Module
impl Module
sourcepub fn parse_bytes(wasm: &[u8]) -> Result<Self>
pub fn parse_bytes(wasm: &[u8]) -> Result<Self>
Parse a module from bytes. Requires parser
feature.
sourcepub fn parse_file(path: impl AsRef<Path> + Clone) -> Result<Self>
pub fn parse_file(path: impl AsRef<Path> + Clone) -> Result<Self>
Parse a module from a file. Requires parser
and std
features.
sourcepub fn parse_stream(stream: impl Read) -> Result<Self>
pub fn parse_stream(stream: impl Read) -> Result<Self>
Parse a module from a stream. Requires parser
and std
features.
sourcepub fn instantiate(
self,
store: &mut Store,
imports: Option<Imports>
) -> Result<ModuleInstance>
pub fn instantiate( self, store: &mut Store, imports: Option<Imports> ) -> Result<ModuleInstance>
Instantiate the module in the given store
Runs the start function if it exists
If you want to run the start function yourself, use ModuleInstance::instantiate
See https://webassembly.github.io/spec/core/exec/modules.html#exec-instantiation
Trait Implementations§
source§impl From<&TinyWasmModule> for Module
impl From<&TinyWasmModule> for Module
source§fn from(data: &TinyWasmModule) -> Self
fn from(data: &TinyWasmModule) -> Self
Converts to this type from the input type.
source§impl From<TinyWasmModule> for Module
impl From<TinyWasmModule> for Module
source§fn from(data: TinyWasmModule) -> Self
fn from(data: TinyWasmModule) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnwindSafe for Module
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.