Hello, I'm using wasmtime for the first time, the experience has been great doc is clear and the setup is quick.
I have a small question about Instance
, Linker
has a get_default
method but Instance
doesn't.
Given the following code snippet:
...
let module = Module::from_file(&engine, wasm_file.as_str())?;
linker.module_async(&mut store, "", &module).await?;
let linked_module = linker.instantiate_pre(&mut store, &module)?;
let instance = linked_module.instantiate_async(&mut store).await?;
let default_func = linker.get_default(&mut store, "")?.typed::<(), (), _>(&store)?;
let result = default_func.call_async(&mut store, ()).await?;
instantiate_pre
and instantiate_async
and everything will still run correctly, should I clone the store for each independent runs?instantiate_async()
's result here stay unused, it feels like it would make more sense if get_default()
would be call on it rather than the linker
, am I using all this in the wrong way?up
Last updated: Nov 22 2024 at 16:03 UTC