golem-wasm-rpc
Defines data types for Golem's remote function invocation and conversions between them.
WitValueis the WIT-defined generic data type capable of representing an arbitrary value, generated bywit-bindgen- A builder and an extractor API for
WitValue Valueis a recursive Rust type which is more convenient to work with thanWitValue. Conversion betweenWitValueandValueis implemented in both directions.- Protobuf message types for describing values and types, and a protobuf version of
WitValueitself and conversion from and toValueandWitValue - JSON representation of WIT values, as defined in the Golem docs.
- Conversion of
Valueto and fromwasmtimevalues
The JSON representation requires additional type information.
Host and stub mode
The golem-wasm-rpc crate can be both used in host and guest environments:
To compile the host version:
cargo build -p golem-wasm --no-default-features --features host
To compile the guest version, has minimal dependencies and feature set to be used in generated stubs:
cargo component build -p golem-wasm --no-default-features --features stub
Feature flags
arbitraryadds anArbitraryinstance forValuebincodeadds Bincode codecs for some typeshost-bindingsenables WIT-generated types for wasmtime hostsjsonadds conversion functions for mapping of a WIT value and type definition to/from JSONpoem_openapiadds poem OpenAPI type class instances for some of the typesprotobufadds the protobuf message typesserdeadds serde JSON serialization for some of the typestextenableswasm-wavebased text representation for valueswasmtimeadds conversion towasmtimeValvalueshostenables all features:arbitrary,bincode,host-bindings,json,poem_openapi,protobuf,serde,text,typeinfo, andwasmtimestubis to be used in generated WASM stubs and disables all features, and generates guest bindings instead of host bindings