This crate contains a macro that builds Wasmcloud Capability Providers that work with the WIT ecosystem by leveraging wit-bindgen
-like (and in this case, wasmtime::component::bindgen
).
This crate can be be used by calling wit-bindgen-wasmcloud
in place of wit-bindgen
, with the following syntax:
wit_bindgen_wasmcloud_provider_host::generate!(
YourProvider,
"wasmcloud:contract",
"your-world"
);
/// Implementation that you will contribute
struct YourProvider;
impl Trait for YourProvider {
...
}
Note that arguments after the second fed directly to wasmtime::component::bindgen
. For example, to build a provider for the wasmCloud keyvalue WIT interface:
/// Generate bindings for a wasmCloud provider
wit_bindgen_wasmcloud::provider::host::generate!(
MyKeyvalueProvider,
"wasmcloud:keyvalue",
"keyvalue"
);
Warning You'll need to have the appropriate WIT interface file (ex.
keyvalue.wit
) in your crate root, at<crate root>/wit/keyvalue.wit
For more details on how the WIT ecosystem and wit-bindgen
/wasmtime::component::bindgen
work, see:
- the
wit-bindgen
repository wasmtime/crates/component-macro
respectively.