Stream: general

Topic: Examples of current wit-bindgen Rust host/guest ecosystem


view this post on Zulip Philpax (Jan 11 2023 at 05:23):

Hey all! I'm looking at migrating to the latest wit-bindgen/wasmtime (we've been stuck at ~August 2022 for a while), but I'm not sure how to wire everything up now - it looks like a few things have moved around and the tests for what I can find are part of a harness.

Is there an example somewhere that I can look at that shows the following?

If there's no one example, links to where I might find individual examples/where to look would also be useful.

Thanks in advance! :)

view this post on Zulip Philpax (Jan 11 2023 at 12:15):

Turns out that the WASI preview2 host is a good example of how to use the new macros, so I'm no longer as lost as I was: https://github.com/bytecodealliance/preview2-prototyping/blob/main/host/src/main.rs (which answers my first three dotpoints)

It looks like the interface dependency situation is still up in the air, though (judging by https://bytecodealliance.zulipchat.com/#narrow/stream/327223-wit-bindgen/topic/status.20of.20resource). Am I correct in assuming that, at present, I'll still need to define duplicate types for each interface/world and fuse them together at the language layer?

For context, I have both internal and external dependencies to a world: I'd like to share types between the imports and exports of a world (so that I can use the same record in a host export and a guest export), and I'd like to have a base .wit/world that I then depend upon and extend in another project.

Polyfill adapter for preview1-using wasm modules to call preview2 functions. - preview2-prototyping/main.rs at main · bytecodealliance/preview2-prototyping

Last updated: Oct 23 2024 at 20:03 UTC