Skip to content

wit-bindgen style macro that generates host (i.e. wasmtime::component) capability provider bindings for wasmCloud

Notifications You must be signed in to change notification settings

vados-cosmonic/wit-bindgen-wasmcloud-provider-host

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

wit-bindgen style macro that generates host (i.e. wasmtime::component) capability provider bindings for wasmCloud

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages