[−][src]Struct parity_wasm::builder::ModuleBuilder  
Module builder
Methods
impl ModuleBuilder[src] 
impl ModuleBuilderimpl<F> ModuleBuilder<F> where
    F: Invoke<Module>, [src] 
impl<F> ModuleBuilder<F> where
    F: Invoke<Module>, pub fn with_callback(callback: F) -> Self[src] 
pub fn with_callback(callback: F) -> SelfNew module builder with bound callback
pub fn with_module(self, module: Module) -> Self[src] 
pub fn with_module(self, module: Module) -> SelfBuilder from raw module
pub fn with_sections<I>(self, sections: I) -> Self where
    I: IntoIterator<Item = Section>, [src] 
pub fn with_sections<I>(self, sections: I) -> Self where
    I: IntoIterator<Item = Section>, Fill module with sections from iterator
pub fn with_section(self, section: Section) -> Self[src] 
pub fn with_section(self, section: Section) -> SelfAdd additional section
pub fn with_signatures(self, bindings: Vec<Signature>) -> Self[src] 
pub fn with_signatures(self, bindings: Vec<Signature>) -> SelfBinds to the type section, creates additional types when required
pub fn push_function(&mut self, func: FunctionDefinition) -> CodeLocation[src] 
pub fn push_function(&mut self, func: FunctionDefinition) -> CodeLocationPush stand-alone function definition, creating sections, signature and code blocks
in corresponding sections.
FunctionDefinition can be build using builder::function builder
pub fn push_memory(&mut self, memory: MemoryDefinition) -> u32[src] 
pub fn push_memory(&mut self, memory: MemoryDefinition) -> u32Push linear memory region
pub fn push_table(&mut self, table: TableDefinition) -> u32[src] 
pub fn push_table(&mut self, table: TableDefinition) -> u32Push table
pub fn push_signature(&mut self, signature: Signature) -> u32[src] 
pub fn push_signature(&mut self, signature: Signature) -> u32Push one function signature, returning it's calling index. Can create corresponding type in type section.
pub fn push_signatures(&mut self, signatures: Vec<Signature>) -> Vec<u32>[src] 
pub fn push_signatures(&mut self, signatures: Vec<Signature>) -> Vec<u32>Push signatures in the module, returning corresponding indices of pushed signatures
pub fn push_import(&mut self, import: ImportEntry) -> u32[src] 
pub fn push_import(&mut self, import: ImportEntry) -> u32Push import entry to module. Not that it does not update calling indices in function bodies.
pub fn push_export(&mut self, export: ExportEntry) -> u32[src] 
pub fn push_export(&mut self, export: ExportEntry) -> u32Push export entry to module.
pub fn function(self) -> FunctionBuilder<Self>[src] 
pub fn function(self) -> FunctionBuilder<Self>Add new function using dedicated builder
pub fn memory(self) -> MemoryBuilder<Self>[src] 
pub fn memory(self) -> MemoryBuilder<Self>Add new linear memory using dedicated builder
pub fn table(self) -> TableBuilder<Self>[src] 
pub fn table(self) -> TableBuilder<Self>Add new table using dedicated builder
pub fn functions(self) -> SignaturesBuilder<Self>[src] 
pub fn functions(self) -> SignaturesBuilder<Self>Define functions section
pub fn with_export(self, entry: ExportEntry) -> Self[src] 
pub fn with_export(self, entry: ExportEntry) -> SelfWith inserted export entry
pub fn with_import(self, entry: ImportEntry) -> Self[src] 
pub fn with_import(self, entry: ImportEntry) -> SelfWith inserted import entry
pub fn import(self) -> ImportBuilder<Self>[src] 
pub fn import(self) -> ImportBuilder<Self>Import entry builder
Examples
use parity_wasm::builder::module; let module = module() .import() .module("env") .field("memory") .external().memory(256, Some(256)) .build() .build(); assert_eq!(module.import_section().expect("import section to exist").entries().len(), 1);
pub fn with_global(self, global: GlobalEntry) -> Self[src] 
pub fn with_global(self, global: GlobalEntry) -> SelfWith global variable
pub fn with_table(self, table: TableType) -> Self[src] 
pub fn with_table(self, table: TableType) -> SelfWith table
pub fn export(self) -> ExportBuilder<Self>[src] 
pub fn export(self) -> ExportBuilder<Self>Export entry builder
Examples
use parity_wasm::builder::module; use parity_wasm::elements::Instruction::*; let module = module() .global() .value_type().i32() .init_expr(I32Const(0)) .build() .export() .field("_zero") .internal().global(0) .build() .build(); assert_eq!(module.export_section().expect("export section to exist").entries().len(), 1);
pub fn global(self) -> GlobalBuilder<Self>[src] 
pub fn global(self) -> GlobalBuilder<Self>Glboal entry builder
Examples
use parity_wasm::builder::module; use parity_wasm::elements::Instruction::*; let module = module() .global() .value_type().i32() .init_expr(I32Const(0)) .build() .build(); assert_eq!(module.global_section().expect("global section to exist").entries().len(), 1);
pub fn with_data_segment(self, segment: DataSegment) -> Self[src] 
pub fn with_data_segment(self, segment: DataSegment) -> SelfAdd data segment to the builder
pub fn data(self) -> DataSegmentBuilder<Self>[src] 
pub fn data(self) -> DataSegmentBuilder<Self>Data entry builder
pub fn build(self) -> F::Result[src] 
pub fn build(self) -> F::ResultBuild module (final step)
Auto Trait Implementations
impl<F> Send for ModuleBuilder<F> where
    F: Send, 
impl<F> Send for ModuleBuilder<F> where
    F: Send, impl<F> Sync for ModuleBuilder<F> where
    F: Sync, 
impl<F> Sync for ModuleBuilder<F> where
    F: Sync, Blanket Implementations
impl<T> From for T[src] 
impl<T> From for Timpl<T, U> Into for T where
    U: From<T>, [src] 
impl<T, U> Into for T where
    U: From<T>, impl<T, U> TryFrom for T where
    T: From<U>, [src] 
impl<T, U> TryFrom for T where
    T: From<U>, type Error = !
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] 
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
    T: ?Sized, [src] 
impl<T> Borrow for T where
    T: ?Sized, impl<T> Any for T where
    T: 'static + ?Sized, [src] 
impl<T> Any for T where
    T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src] 
fn get_type_id(&self) -> TypeId🔬 This is a nightly-only experimental API.  (get_type_id)
this method will likely be replaced by an associated static
Gets the TypeId of self. Read more
impl<T> BorrowMut for T where
    T: ?Sized, [src] 
impl<T> BorrowMut for T where
    T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src] 
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
    U: TryFrom<T>, [src] 
impl<T, U> TryInto for T where
    U: TryFrom<T>,