fluentcidocs
Website GitHub

Language SDKs

Rust

Build a Wasm cdylib with typed Rust functions and Extism PDK exports.

Scaffold

fluentci init
# Or select explicitly:
fluentci modules add ci --sdk rust

Rust is the default SDK. The generated Cargo.toml creates a cdylib and pins extism-pdk. Its [workspace] keeps the starter independent from an enclosing Cargo workspace unless deliberately integrated.

Minimal export

use extism_pdk::*;

#[plugin_fn]
pub fn hello() -> FnResult<String> {
    Ok("Hello from FluentCI".into())
}

The macro exposes hello as a plugin job. This minimal example needs no separate JavaScript export wrapper. Returning Err communicates a failed invocation.

Build and run

Install Cargo, rustc, rustup, and the Wasm target:

rustup target add wasm32-unknown-unknown
fluentci run main hello
fluentci modules main --json

The CLI builds the selected Cargo library for Wasm in release mode and resolves the library's artifact name from Cargo metadata. In a multi-package Cargo workspace it selects the requested module instead of treating every package as one plugin. Custom artifact overrides require an explicit build command.

Engine SDK operations

extism-pdk provides guest input/output and export machinery. Host pipeline operations additionally use the engine's Rust PDK/types APIs; add the dependencies needed by that SDK rather than expecting all host functions from the minimal starter dependency. See the engine Rust examples for pipeline and native-plan integration.

A Rust plugin and the Rust CLI are separate build targets. Rebuilding a guest module does not require rebuilding Studio; compiling the CLI itself does.

Made with ♥ in Antananarivo, Madagascar.
Search documentation