Build a Rust Native Plugin
Use the nemo-relay-plugin crate to create an in-process native plugin without
writing the C ABI by hand. The SDK exports the stable ABI entry point and
provides typed helpers for the supported registration surfaces.
This example builds a native plugin that registers an event subscriber. The
repository also includes an extended example in examples/rust-native-plugin
with validation, middleware, marks, scopes, and a configuration schema.
Create the Project
Create a Rust library project with this Cargo.toml file:
Add the following implementation to src/lib.rs:
Create the Manifest
Create relay-plugin.toml with the following content:
Update the library filename for your platform: use .dylib on macOS, .so
on Linux, or .dll on Windows. Replace <platform-library-file> in both
manifest fields with that filename.
Build, Register, and Validate
Build the library, calculate its digest, and register the plugin with the following commands. The digest command requires Python 3.
Use the following PowerShell command on Windows:
Replace <platform-library-file> in the digest command, then replace
sha256:<artifact-sha256> with its output before you run plugins add. The
command writes a [[plugins.dynamic]] manifest reference. Use
nemo-relay plugins edit or edit that record to add component fields when the
plugin accepts configuration.
Keep tests outside src, use the shared DTOs re-exported by
nemo-relay-plugin, and do not retain host-owned ABI handles after a callback
returns. Refer to Configure Discoverable
Plugins for trust-policy configuration.