Stream: SIG Documentation

Topic: Rust code for Wasm source in the examples


view this post on Zulip Friedrich Vandenberghe (Jun 09 2026 at 07:34):

First and foremost, sorry if this is the incorrect channel for this, but I would like to add multiple languages of Wasm sources in the example docs. The issue is that I don't know how to name the Wasm Rust sources, given that the current files are named: examples/hello.wat, examples/hello.rs etc. I think that the best way would be to structure the examples somewhat more, but no clue what structure would be best.

Currently, the host code is provided in Rust, C, and C++, but the Wasm source is only provided in WAT. Personally, I've had it happen on multiple occasions where I wanted to use a certain Wasm feature, and then was stumped with writing the correct Rust code to match the given WAT.

view this post on Zulip Friedrich Vandenberghe (Jun 09 2026 at 07:35):

To be clear, I would like to modify the Wasm Source to add a Rust version like how it is done in the Host Source
image.png

view this post on Zulip Victor Adossi (Jun 09 2026 at 07:58):

Hey @Friedrich Vandenberghe just to make sure we've got the context right, you're referring to the documentation in wasmtime for the hello example, right?

I think that section was written to emphasize usage of wasmtime-as-a-host via multiple languages, which is why the somewhat longer definition/space it would take up to write the component (& build instructions) is avoided.

That said, I could be wrong and it's a reasonable question to raise, but this might be a good question for the #**wasmtime> channel actually rather than this one, unless someone from wasmtime happens to wander by here.

view this post on Zulip Friedrich Vandenberghe (Jun 09 2026 at 08:10):

Yes indeed, ideally I would like to provide Rust example code for all the examples that contain a Wasm Source.

I believe that you're correct, there's a clear focus on the host-side of things. But, to my knowledge, the Wasmtime book is the only place that contains examples on core Wasm, WASIp1, and WASIp2. The component model book contains instructions on how to write components for a whole range of guest languages, but evidently the examples are solely focused on WASIp2.


Last updated: Jul 29 2026 at 05:03 UTC