Hi, I do
let mut store = Store::new(&engine, state);
let component = Component::from_file(&engine, "component.wasm")?;
let instance = linker.instantiate_async(&mut store, &component).await?;
let mut result = [];
if let Some(func) = instance.get_func(&mut store, function) {
func.call_async(&mut store, &[], &mut result).await?;
println!("result : {:?}", result);
} else {
println!("No func")
}
But I getExpected (1) result, go (0)
My component is https://github.com/bytecodealliance/wasmtime/blob/main/examples/component/wasm/guest.rs.
So the returned value is a f32.
I miss something?
you need to pass in a 1-length result array, so you'd have to fill in a dummy result such as let mut result = [Val::U8(0)]; so that would get filled in
You can find more documentation for call here
Last updated: Dec 06 2025 at 06:05 UTC