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