- DEMO: The out-of-the-box WASI API experience in Rust and TinyGo
DEMO: The out-of-the-box WASI API experience in Rust and TinyGo
- We have a new Hello World experience in the wasmCloud ecosystem which has full component support - we’ve been talking about this for a while. We’ve been able to run components in wasmCloud using WASI APIs for some time but this new approach is distinct.
- The difference is we will now be pushing the developer experience to be components first. Above all this makes building Wasm applications in all languages much simpler. And means wasmCloud is ready to work with a host of languages as support matures.
- Instead of building using the wambus ABI we’ll use components everywhere, as much as we can.
- This will allow us to hook into the common ecosystem and current Wasm standards.
- Note: when writing a wasm actor component and using basic WASI APIs, WIT defines imports and exports.
- Hello World exports 1 function
- Brooks shows how this looks in both Rust and TinyGo - check out the recording:
- Build using
wash inspect --wit hello.wasmto inspect our components.
- Build using
- The same model as works in Rust, works in Go, and any other language thanks to WIT and WIT bindgen.
- Ultimately, the goal is not to use WASI or wasmCloud APIs directly, it’s to use the standard libraries you’re used to using and use that libraries Wasm support to interact with WASI.
Q: When you do the adapt on wasm tools does it figure out where the preview 1 Wasm file is or do you pass it as a parameter?
A: Yes you pass it as a parameter.
Q: Which version of Wasmtime makes this functionality possible?
A: Wasmtime 16 - not yet quite released but we’re tuning for this release.
Note: We are pinning on Wasmtime 16 and soon, at least in Rust, we’ll add Preview 2 as a target so there will be no need for adaptation. This requirement will continue to disappear as Preview 2 reaches prime time.
Q: When we use Wasmtime 16 and wasmCloud supports
wasi messaging is that something wasmCloud does using regular Wasmtime 16 or are we forking?
A: We just build directly on Wasmtime 16 - we don’t fork but we do use its regular imports and exports - wasi cli etc.
- We have a new FAQ page that will be a specific area for docs that still need a bit of work, and will feature common questions and answers (of course). Some content is temporary, some will be long-lived. We’re soliciting feedback on common questions and general feedback is most welcome. https://github.com/wasmCloud/wasmcloud.com/pull/244
We had a much broader discussion and so check out the full session in the recording below. We’d like to wish a very Happy Holidays to our wonderful community. We’ll be back next week the 27th, full of lovely food and festive cheer. See you then.