Hi,
I am looking for an exemplary example of how to create and compose Wasm components.
WASI
WASIp3
I see that WASIp3 is in progress. I assume that using WASIp3 for the example would be ideal. However, WASIp3 may not be ready to create an example of composing components. Can I get some advice here, please?
WASIp2
When I have tried to write an example of how to create and compose Wasm components using cargo component
I have hit an issue. Specifically, the issue that cargo-component
doesn't yet work with the WASIp2 target < https://github.com/bytecodealliance/cargo-component/issues/364#issuecomment-2575877508 >
WASIp1
The official Rust Wasm component model documentation < https://component-model.bytecodealliance.org/language-support/rust.html > uses WASIp1 exclusively.
Is there a timeline for when the cargo component
crate will support WASIp2?
Is it possible that the cargo component
crate will just skip straight to WASIp3 (because of potential double handling)?
Is there any indication of a timeline/timeframe where I could create an example of using Wasm components using the WASIp3 target in production?
Thanks
Tim McCallum
I have started a GitHub repo with what I think is currently a suitable example (using wasip1):
https://github.com/tpmccallum/composing-wasm-components/tree/main/geolocation
If I follow the README.md's instructions I get the following error:
error: failed to create a target world for package `dms-converter` (/Users/tpmccallum/composing-wasm-components/geolocation/dms-converter/Cargo.toml)
Caused by:
0: failed to parse local target from directory `/Users/tpmccallum/composing-wasm-components/geolocation/dms-converter/wit`
1: expected ')', found ':'
--> /Users/tpmccallum/composing-wasm-components/geolocation/dms-converter/wit/world.wit:14:42
|
14 | convert-to-dms: func(normalized: docs:normalizer/normalize/normalized-coordinates) -> dms-coordinates;
Hey @Timothy McCallum sorry I'm a bit late here, but it looks like there is a syntax error in the WIT there
convert-to-dms: func(normalized: docs:normalizer/normalize/normalized-coordinates) -> dms-coordinates;
Should look like this:
convert-to-dms: func(normalized: normalized-coordinates) -> dms-coordinates;
And earlier in the interface, you'll need to import that type:
interface convert {
use docs:normalizer/normalize.{normalized-coordinates};
// ... rest ...
}
Hey @Victor Adossi
Thank you so much. Sorry about the late reply. I have been beavering away on the --invoke
implementation. I appreciate your response and am back composing components again.
Thanks again
Tim
Absolutely no problem Tim!
Last updated: Apr 08 2025 at 18:03 UTC