Update examples/plugin.rs

Co-Authored-By: MarkMcCaskey <MarkMcCaskey@users.noreply.github.com>
This commit is contained in:
Mackenzie Clark 2019-04-29 11:18:35 -07:00 committed by GitHub
parent 0add4584e3
commit bc0289cb84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,7 @@ fn main() {
let instance = let instance =
instantiate(PLUGIN_WASM, &base_imports).expect("failed to instantiate wasm module"); instantiate(PLUGIN_WASM, &base_imports).expect("failed to instantiate wasm module");
// 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 = instance.func::<(i32), i32>("plugin_entrypoint").unwrap();
let result = entry_point.call(2).expect("failed to execute plugin"); let result = entry_point.call(2).expect("failed to execute plugin");
println!("result: {}", result); println!("result: {}", result);