[−][src]Struct walrus::Module
A wasm module.
Fields
imports: ModuleImports
tables: ModuleTables
types: ModuleTypes
funcs: ModuleFunctions
globals: ModuleGlobals
locals: ModuleLocals
exports: ModuleExports
memories: ModuleMemories
data: ModuleData
Registration of passive data segments, if any
elements: ModuleElements
Registration of passive element segments, if any
start: Option<FunctionId>
The start
function, if any
producers: ModuleProducers
Representation of the eventual custom section, producers
customs: ModuleCustomSections
Custom sections found in this module.
name: Option<String>
The name of this module, used for debugging purposes in the name
custom section.
Methods
impl Module
[src]
pub fn add_import_func(
&mut self,
module: &str,
name: &str,
ty: TypeId
) -> FunctionId
[src]
&mut self,
module: &str,
name: &str,
ty: TypeId
) -> FunctionId
Add an imported function to this module
pub fn add_import_memory(
&mut self,
module: &str,
name: &str,
shared: bool,
initial: u32,
maximum: Option<u32>
) -> MemoryId
[src]
&mut self,
module: &str,
name: &str,
shared: bool,
initial: u32,
maximum: Option<u32>
) -> MemoryId
Add an imported memory to this module
pub fn add_import_table(
&mut self,
module: &str,
name: &str,
initial: u32,
max: Option<u32>,
kind: TableKind
) -> TableId
[src]
&mut self,
module: &str,
name: &str,
initial: u32,
max: Option<u32>,
kind: TableKind
) -> TableId
Add an imported table to this module
pub fn add_import_global(
&mut self,
module: &str,
name: &str,
ty: ValType,
mutable: bool
) -> GlobalId
[src]
&mut self,
module: &str,
name: &str,
ty: ValType,
mutable: bool
) -> GlobalId
Add an imported global to this module
impl Module
[src]
pub fn with_config(config: ModuleConfig) -> Self
[src]
Create a default, empty module that uses the given configuration.
pub fn from_file<P>(path: P) -> Result<Module> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Construct a new module from the given path with the default configuration.
pub fn from_file_with_config<P>(
path: P,
config: &ModuleConfig
) -> Result<Module> where
P: AsRef<Path>,
[src]
path: P,
config: &ModuleConfig
) -> Result<Module> where
P: AsRef<Path>,
Construct a new module from the given path and configuration.
pub fn from_buffer(wasm: &[u8]) -> Result<Module>
[src]
Construct a new module from the in-memory wasm buffer with the default configuration.
pub fn emit_wasm_file<P>(&self, path: P) -> Result<()> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Emit this module into a .wasm
file at the given path.
pub fn emit_wasm(&self) -> Result<Vec<u8>>
[src]
Emit this module into an in-memory wasm buffer.
pub fn functions(&self) -> impl Iterator<Item = &Function>
[src]
Returns an iterator over all functions in this module
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,