mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-22 21:21:33 +00:00
Deprecate Instance::func
and Instance::dyn_func
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user