()
| 11 | use wasmtime::*; |
| 12 | |
| 13 | fn main() -> Result<()> { |
| 14 | // Load our previously compiled wasm file (built previously with Cargo) and |
| 15 | // also ensure that we generate debuginfo so this executable can be |
| 16 | // debugged in GDB. |
| 17 | let engine = Engine::new( |
| 18 | Config::new() |
| 19 | .debug_info(true) |
| 20 | .cranelift_opt_level(OptLevel::None), |
| 21 | )?; |
| 22 | let mut store = Store::new(&engine, ()); |
| 23 | let module = Module::from_file(&engine, "target/wasm32-unknown-unknown/debug/fib.wasm")?; |
| 24 | let instance = Instance::new(&mut store, &module, &[])?; |
| 25 | |
| 26 | // Invoke `fib` export |
| 27 | let fib = instance.get_typed_func::<i32, i32>(&mut store, "fib")?; |
| 28 | println!("fib(6) = {}", fib.call(&mut store, 6)?); |
| 29 | Ok(()) |
| 30 | } |
nothing calls this directly
no test coverage detected