export example

This commit is contained in:
NikVolf
2017-06-27 14:12:57 +03:00
parent 447c3db90d
commit c72dfae354

View File

@ -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)
}