mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-28 22:22:02 +00:00
example for module()
This commit is contained in:
@ -346,7 +346,7 @@ mod tests {
|
|||||||
.build()
|
.build()
|
||||||
.bind();
|
.bind();
|
||||||
|
|
||||||
assert_eq!(result.len(), 1);
|
assert_eq!(result.len(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -442,6 +442,22 @@ impl<F> Invoke<elements::DataSegment> for ModuleBuilder<F>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Start new module builder
|
/// Start new module builder
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// use parity_wasm::builder;
|
||||||
|
///
|
||||||
|
/// let module = builder::module()
|
||||||
|
/// .function()
|
||||||
|
/// .signature().param().i32().build()
|
||||||
|
/// .body().build()
|
||||||
|
/// .build()
|
||||||
|
/// .build();
|
||||||
|
///
|
||||||
|
/// assert_eq!(module.type_section().expect("type section to exist").types().len(), 1);
|
||||||
|
/// assert_eq!(module.function_section().expect("function section to exist").entries().len(), 1);
|
||||||
|
/// assert_eq!(module.code_section().expect("code section to exist").bodies().len(), 1);
|
||||||
|
/// ```
|
||||||
pub fn module() -> ModuleBuilder {
|
pub fn module() -> ModuleBuilder {
|
||||||
ModuleBuilder::new()
|
ModuleBuilder::new()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user