mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-05-17 01:31:29 +00:00
lost save
This commit is contained in:
parent
762893d079
commit
23dd1d2f7f
@ -6,7 +6,7 @@ use parity_wasm::ModuleInstanceInterface;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<_> = args().collect();
|
let args: Vec<_> = args().collect();
|
||||||
if args.len() != 2 {
|
if args.len() != 3 {
|
||||||
println!("Usage: {} <wasm file> <arg>", args[0]);
|
println!("Usage: {} <wasm file> <arg>", args[0]);
|
||||||
println!(" wasm file should contain exported `_call` function with single I32 argument");
|
println!(" wasm file should contain exported `_call` function with single I32 argument");
|
||||||
return;
|
return;
|
||||||
@ -15,6 +15,6 @@ fn main() {
|
|||||||
let program = parity_wasm::ProgramInstance::new().expect("Failed to load program");
|
let program = parity_wasm::ProgramInstance::new().expect("Failed to load program");
|
||||||
let module = parity_wasm::deserialize_file(&args[1]).expect("Failed to load module");
|
let module = parity_wasm::deserialize_file(&args[1]).expect("Failed to load module");
|
||||||
let module = program.add_module("main", module).expect("Failed to initialize module");
|
let module = program.add_module("main", module).expect("Failed to initialize module");
|
||||||
let argument: i32 = args[1].parse().expect("Integer argument required");
|
let argument: i32 = args[2].parse().expect("Integer argument required");
|
||||||
println!("Result: {:?}", module.execute_export("_call", vec![parity_wasm::RuntimeValue::I32(argument)]));
|
println!("Result: {:?}", module.execute_export("_call", vec![parity_wasm::RuntimeValue::I32(argument)]));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user