Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.89 KB

File metadata and controls

48 lines (36 loc) · 1.89 KB

wit-bindgen-wasmcloud-provider-host

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).

Usage

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: