Noobie here. I'd like my wasmtime rust host to dynamically instantiate components of a known {import + export + default}. Here is what I tried:
cargo build --target wasm32-unknown-unknown --release
--> foo.wasmConvert guest from wasm to component: wit-component foo.wasm
--> component.wasm
(So far, the same steps as in https://github.com/bytecodealliance/wit-bindgen/blob/main/crates/wit-bindgen-demo/build.sh)
On host, use wit_bindgen_host_wasmtime_rust::generate!(...)
wasmtime::component::Component
. I'm trying to build one via Component::new()
, from_binary()
, or from_file()
; and none of these works.Question:
Component
from a &[u8]?I'm using
wit-component = git b0a34f0
wasmtime = git 7b5fd84
That's the right workflow, yeah, and steps 1/2 are slated to be combined with the cargo-component
subcommand eventually as well.
What errro are you getting from Component::new
? (any of those ctors should work)
Oops I just needed config.wasm_component_model(true);
. Thanks for your super quick response. <3
Last updated: Nov 22 2024 at 16:03 UTC