Deprecate Instance::func and Instance::dyn_func

This commit is contained in:
Mark McCaskey
2020-03-26 17:11:37 -07:00
parent a18371eb91
commit 2fb8f8197b
7 changed files with 154 additions and 101 deletions

View File

@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use wasmer_runtime::{compile, func, imports};
use wasmer_runtime::{compile, func, imports, Func};
use wasmer_runtime_core::vm::Ctx;
use wasmer_wasi::{
generate_import_object_for_version,
@ -159,7 +159,7 @@ fn main() {
initialize(instance.context_mut());
// get a reference to the function "plugin_entrypoint" which takes an i32 and returns an i32
let entry_point = instance.func::<(i32), i32>("plugin_entrypoint").unwrap();
let entry_point: Func<i32, i32> = instance.exports.get("plugin_entrypoint").unwrap();
// call the "entry_point" function in WebAssembly with the number "2" as the i32 argument
let result = entry_point.call(2).expect("failed to execute plugin");
println!("result: {}", result);