Extism Rust PDK
The Plug-in Development Kit for writing Extism WebAssembly plug-ins in Rust.
Repository Health
Technical Analysis
The Extism Rust PDK (Plug-in Development Kit) is the library you use to write Extism plug-ins in Rust that compile to WebAssembly. It provides the glue between your Rust code and the Extism runtime, so plug-in functions can be exported, receive typed input, return typed output, read configuration, persist variables, and call host-provided functions.
Extism is a universal plug-in system that embeds Wasm plug-ins into applications across many host languages. The Rust PDK lets you author those plug-ins ergonomically with a #[plugin_fn] macro, automatic input/output conversion for JSON, MessagePack, and Protobuf, and helpers for HTTP, host functions, and persistent state.
What You Get
- A
#[plugin_fn]macro that exports Rust functions as Extism plug-in entry points - Automatic typed input/output conversion for JSON, MessagePack, and Protobuf
- Access to plug-in configuration values and persistent variables
- Helpers for making outbound HTTP requests from within a plug-in
- Declarations for calling host-provided functions from guest Wasm code
Common Use Cases
- Writing sandboxed Wasm plug-ins in Rust for an Extism-powered host application
- Extending an application with user-supplied logic that runs safely in Wasm
- Building portable plug-ins that run across any Extism host language
- Exchanging structured data between host and plug-in via typed serialization
Under The Hood
Architecture — The PDK bridges guest Rust and the Extism host across the Wasm memory boundary. The #[plugin_fn] and host-function macros (src/macros.rs, derive/src/lib.rs) generate the exported symbols and marshalling code the host expects. Low-level host imports are declared in src/extism.rs, while src/memory.rs, src/to_memory.rs, src/config.rs, src/var.rs, and src/http.rs provide safe wrappers over the raw host calls for memory handles, configuration, variables, and HTTP. Value encoding is delegated to the extism-convert crate so the same Rust types can round-trip as JSON, MessagePack, or Protobuf.
Tech Stack — Written in Rust (2021 edition) and compiled to WebAssembly. It depends on serde/serde_json and base64 for data handling, anyhow for errors, the companion extism-pdk-derive proc-macro crate, and extism-convert/extism-manifest from the Extism ecosystem. Feature flags toggle HTTP, MessagePack, and Protobuf support.
Code Quality — The crate is small, focused, and split cleanly between the runtime wrappers and the derive macros, with in-repo examples, a count_vowels.wasm sample, and a test directory. As an official Extism component it is mature and versioned in lockstep with the wider 1.x Extism release line, though day-to-day activity is modest.
API Design — Developer experience is a priority: a single #[plugin_fn] macro removes nearly all of the Wasm ABI boilerplate, and typed conversions mean plug-in authors write ordinary Rust functions with familiar serde types. The README walks through project setup end to end, and the API mirrors the other Extism PDKs so knowledge transfers across languages.