| Crates.io | wash-runtime |
| lib.rs | wash-runtime |
| version | 0.1.0 |
| created_at | 2025-10-23 16:12:08.712488+00 |
| updated_at | 2025-10-23 16:12:08.712488+00 |
| description | Opinionated wasmtime wrapper that provides a runtime and workload API for executing Wasm components |
| homepage | |
| repository | https://github.com/wasmCloud/wash |
| max_upload_size | |
| id | 1897313 |
| size | 26,630,050 |
wash-runtime is an opinionated Wasmtime wrapper that provides a runtime and workload API for executing WebAssembly components. It offers a simplified interface for embedding Wasm component execution in Rust applications with built-in support for WASI interfaces.
use std::sync::Arc;
use std::collections::HashMap;
use wash_runtime::{
engine::Engine,
host::{HostBuilder, HostApi},
plugin::{
wasi_config::RuntimeConfig,
wasi_http::HttpServer,
},
types::{WorkloadStartRequest, Workload},
};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Create a Wasmtime engine
let engine = Engine::builder().build()?;
// Configure plugins
let http_plugin = HttpServer::new("127.0.0.1:8080".parse()?);
let runtime_config_plugin = RuntimeConfig::default();
// Build and start the host
let host = HostBuilder::new()
.with_engine(engine)
.with_plugin(Arc::new(http_plugin))?
.with_plugin(Arc::new(runtime_config_plugin))?
.build()?;
let host = host.start().await?;
// Start a workload
let req = WorkloadStartRequest {
workload: Workload {
namespace: "test".to_string(),
name: "test-workload".to_string(),
annotations: HashMap::new(),
service: None,
components: vec![],
host_interfaces: vec![],
volumes: vec![],
},
};
host.workload_start(req).await?;
Ok(())
}
The crate supports the following cargo features:
wasi-http (default): HTTP client and server support via wasmtime-wasi-httpwasi-config (default): Runtime configuration interfacewasi-logging (default): Logging interfacewasi-blobstore (default): Blob storage interfacewasi-keyvalue (default): Key-value storage interfaceoci: OCI registry integration for pulling componentswash-runtime provides three main abstractions:
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.