[−][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
custom: Vec<CustomSection>
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 from_file<P>(path: P) -> Result<Module> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Construct a new module.
pub fn from_buffer(wasm: &[u8]) -> Result<Module>
[src]
Construct a new module.
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]
&self
) -> impl Iterator<Item = &Function>
Returns an iterator over all functions in this module
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,