flowchart LR R["Rust plugin SourcePlugin/FilterPlugin/ SinkPlugin trait impl"] -- "export_*_plugin! macro" --> V["mads_rust_plugin_register() C ABI vtable"] V -- "dlopen + dlsym" --> L["mads rsource/rfilter/rsink"]
Commands: rsource / rfilter / rsink
mads rsource, mads rfilter, and mads rsink are Rust-plugin counterparts to mads source/filter/sink: same roles, same CLI shape, but they load a compiled Rust cdylib through a plain C ABI (dlopen/dlsym) instead of the C++ pugg kernel. Not available on Windows.
Related: source / filter / sink (the C++ equivalents this mirrors) · plugin (scaffolding a Rust plugin with --rust)
Synopsis
mads rsource [common options] [-p|--period ms] [plugin.so]
mads rfilter [common options] [-p|--period ms] [-b|--dont-block] [plugin.so]
mads rsink [common options] [-b|--dont-block] [plugin.so]Description
Same source file (src/main/rust_plugin_loader.cpp), compiled three times, mirroring plugin_loader.cpp’s structure — but instead of a pugg::Kernel, it dlopens the plugin and dlsyms a single entry point, mads_rust_plugin_register(), which returns a static vtable of C function pointers (create, set_params, get_output/load_data+process, destroy, …).
Not available on Windows — these three targets are excluded from the build there.
The vtable carries its own MADS_RUST_PLUGIN_VERSION (currently 1), checked on load — this is independent of the C++ plugin protocol version (P8 as of this writing) covered in plugin. A Rust plugin cannot be migrated with mads plugin --update; bump the mads-plugin crate dependency in its Cargo.toml instead.
Options
Same shape as the C++ loaders (see source / filter / sink for the shared option table) with two differences:
| Value | |
|---|---|
| Default agent names | rpublish / rbridge / rfeedback (r-prefixed) |
| Default plugin file | publish.plugin / bridge.plugin / feedback.plugin — same filenames as the C++ loaders’ defaults |
Because the default plugin filenames are identical to the C++ loaders’ (publish.plugin, etc.), a bare mads rsource (no plugin argument) will happily dlopen a C++/pugg-based publish.plugin if that’s the only one installed — the file loads fine as a shared library, but dlsym then fails to find mads_rust_plugin_register in it, since that plugin exports pugg’s registration symbol instead. The resulting error is clear, but easy to misread at first glance as “plugin not found.”