Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Rust examples

Reference WebAssembly components written in Rust that demonstrate how to build, run, and publish with wash. Each example is a self-contained project with its own Cargo.toml, .wash/config.yaml, and README.md.

Looking for examples in other languages? Checkout our docs at wasmcloud.com/docs/examples/.

Available examples

Example Description
blobby Simple file server demonstrating CRUD operations against the wasi:blobstore interface.
grpc-hello-world gRPC client and server components showing how to make and serve gRPC calls from a wasmCloud component.
otel-config HTTP service instrumented with OpenTelemetry tracing, logs, and metrics via wasi:otel, with the OTel Resource built from wasi:config.
qrcode HTTP service that generates QR codes.

Running an example

From the example directory:

# fetch wit deps and build the component
wash build

wash build reads the build.command from .wash/config.yaml, fetches the example's WIT dependencies, and produces the component artifact at build.component_path.

To run your component locally:

# build and deploys your WebAssembly component to a local wasmCloud environment
wash dev

We recommend running wash dev with watchexec. watchexec watches the project directory and restarts wash dev on every save (-r restarts the running command, -c clears the screen).

First install watchexec:

cargo install watchexec-cli

Then start your development loop:

watchexec -c -r 'wash dev'

Checkout our docs for more information including the Rust Language Guide.

CI

Every example listed above is built, formatted, linted, and on pushes to main, published to ghcr.io/wasmcloud/components/<name> by the examples workflow. The workflow enforces that any new example directory is wired up to a CI job.