Stream: cargo-component

Topic: Confused on the Difference between Guest and Host


view this post on Zulip chaosprint (Jun 02 2024 at 11:28):

I see that cargo component new --lib some will provide some kind of template, but https://github.com/bytecodealliance/wit-bindgen seems to have a very different approach. So which one should I use for component model? and what's the difference between Guest and Host

A language binding generator for WebAssembly interface types - bytecodealliance/wit-bindgen

view this post on Zulip Ramon Klass (Jun 03 2024 at 11:51):

cargo component new and wit-bindgen::generate! produce the same code, wit-bindgen is older and cargo component fits better into the future workflow when compilers can directly output wasip2 and later. I still use wit-bindgen everywhere, but I'm not sure myself if that is meant to stay forever, someone deeper involved may know

about Guest and Host, Guest is the component side, it has to implement the exports and may call the imports
Host is the other side, it needs to implement (or provide) the imports your component expects and it may call the exports of your component

parts of the host may be implemented as other components, but from the viewpoint of your component, Guest is what the component needs to implement and host is the one who will call into the component and also provide the expected imports


Last updated: Oct 23 2024 at 20:03 UTC