Struct parity_wasm::builder::ModuleBuilder
[−]
[src]
pub struct ModuleBuilder<F = Identity> { /* fields omitted */ }
Module builder
Methods
impl ModuleBuilder
[src]
fn new() -> Self
New empty module builder
impl<F> ModuleBuilder<F> where
F: Invoke<Module>,
[src]
F: Invoke<Module>,
fn with_callback(callback: F) -> Self
New module builder with bound callback
fn with_module(self, module: Module) -> Self
Builder from raw module
fn with_sections<I>(self, sections: I) -> Self where
I: IntoIterator<Item = Section>,
I: IntoIterator<Item = Section>,
Fill module with sections from iterator
fn with_section(self, section: Section) -> Self
Add additional section
fn with_signatures(self, bindings: Vec<Signature>) -> Self
Binds to the type section, creates additional types when required
fn push_function(&mut self, func: FunctionDefinition) -> CodeLocation
Push stand-alone function definition, creating sections, signature and code blocks
in corresponding sections.
FunctionDefinition
can be build using builder::function
builder
fn push_memory(&mut self, memory: MemoryDefinition) -> u32
Push linear memory region
fn push_table(&mut self, table: TableDefinition) -> u32
Push table
fn push_signature(&mut self, signature: Signature) -> u32
Push one function signature, returning it's calling index. Can create corresponding type in type section.
fn push_signatures(&mut self, signatures: Vec<Signature>) -> Vec<u32>
Push signatures in the module, returning corresponding indices of pushed signatures
fn push_import(&mut self, import: ImportEntry) -> u32
Push import entry to module. Not that it does not update calling indices in function bodies.
fn push_export(&mut self, export: ExportEntry) -> u32
Push export entry to module.
fn function(self) -> FunctionBuilder<Self>
Add new function using dedicated builder
fn memory(self) -> MemoryBuilder<Self>
Add new linear memory using dedicated builder
fn table(self) -> TableBuilder<Self>
Add new table using dedicated builder
fn functions(self) -> SignaturesBuilder<Self>
Define functions section
fn with_export(self, entry: ExportEntry) -> Self
With inserted export entry
fn with_import(self, entry: ImportEntry) -> Self
With inserted import entry
fn import(self) -> ImportBuilder<Self>
Import entry builder
fn with_global(self, global: GlobalEntry) -> Self
With global variable
fn export(self) -> ExportBuilder<Self>
Export entry builder
fn global(self) -> GlobalBuilder<Self>
Glboal entry builder
fn build(self) -> F::Result
Build module (final step)