mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-28 14:11:57 +00:00
export example
This commit is contained in:
@ -332,6 +332,24 @@ impl<F> ModuleBuilder<F> where F: Invoke<elements::Module> {
|
||||
}
|
||||
|
||||
/// Export entry builder
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// use parity_wasm::builder::module;
|
||||
/// use parity_wasm::elements::Opcode::*;
|
||||
///
|
||||
/// 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("import section to exist").entries().len(), 1);
|
||||
/// ```
|
||||
pub fn export(self) -> export::ExportBuilder<Self> {
|
||||
export::ExportBuilder::with_callback(self)
|
||||
}
|
||||
|
Reference in New Issue
Block a user