mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-05-29 15:41:36 +00:00
commit
e76f33d6c8
@ -13,8 +13,8 @@ along with experimental interpreter
|
|||||||
|
|
||||||
extern crate parity_wasm;
|
extern crate parity_wasm;
|
||||||
|
|
||||||
let module = parity_wasm::deserialize_file("./res/cases/v1/hello.wasm");
|
let module = parity_wasm::deserialize_file("./res/cases/v1/hello.wasm").unwrap();
|
||||||
assert_eq!(module.code_section().is_some());
|
assert!(module.code_section().is_some());
|
||||||
|
|
||||||
let code_section = module.code_section().unwrap(); // Part of the module with functions code
|
let code_section = module.code_section().unwrap(); // Part of the module with functions code
|
||||||
|
|
||||||
|
@ -253,11 +253,7 @@ impl<E: UserFunctionExecutor> ModuleInstanceInterface for NativeModuleInstance<E
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use parity_wasm::interpreter::{CallerContext, Error, ExecutionParams, ExportEntryType,
|
/// use parity_wasm::interpreter::{CallerContext, Error, RuntimeValue, UserFunctionExecutor};
|
||||||
/// FunctionSignature, ItemIndex, ModuleInstance,
|
|
||||||
/// ModuleInstanceInterface, ProgramInstance, RuntimeValue,
|
|
||||||
/// UserDefinedElements, UserError, UserFunctionDescriptor,
|
|
||||||
/// UserFunctionExecutor};
|
|
||||||
///
|
///
|
||||||
/// struct MyExecutor;
|
/// struct MyExecutor;
|
||||||
///
|
///
|
||||||
@ -270,8 +266,8 @@ impl<E: UserFunctionExecutor> ModuleInstanceInterface for NativeModuleInstance<E
|
|||||||
/// match name {
|
/// match name {
|
||||||
/// "add" => {
|
/// "add" => {
|
||||||
/// // fn add(a: u32, b: u32) -> u32
|
/// // fn add(a: u32, b: u32) -> u32
|
||||||
/// let b = context.value_stack.pop_as::<u32>()? as u32;
|
/// let b = context.value_stack.pop_as::<u32>()?;
|
||||||
/// let a = context.value_stack.pop_as::<u32>()? as u32;
|
/// let a = context.value_stack.pop_as::<u32>()?;
|
||||||
/// let sum = a + b;
|
/// let sum = a + b;
|
||||||
/// Ok(Some(RuntimeValue::I32(sum as i32)))
|
/// Ok(Some(RuntimeValue::I32(sum as i32)))
|
||||||
/// }
|
/// }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user