Fidius — a Rust plugin framework for trait-to-dylib plugin systems.
This is the facade crate. Interface crates should depend on fidius only.
It re-exports everything needed to define interfaces and implement plugins.
For interface crate authors
pub use fidius::{plugin_impl, PluginError};
#[fidius::plugin_interface(version = 1, buffer = PluginAllocated)]
pub trait MyPlugin: Send + Sync {
fn process(&self, input: String) -> String;
}
For plugin crate authors
use my_interface::{plugin_impl, MyPlugin, PluginError};
pub struct MyImpl;
#[plugin_impl(MyPlugin)]
impl MyPlugin for MyImpl {
fn process(&self, input: String) -> String {
format!("processed: {input}")
}
}
fidius::fidius_plugin_registry!();
What fidius does not provide: timeouts and cancellation
Fidius has no built-in timeout, deadline, or cancellation mechanism
for plugin method calls. A call to PluginHandle::call_method (or
call_method_raw) runs to completion, panics, or — in the case of a
truly stuck plugin — never returns. There is no PluginError::Timeout
variant and the framework will not interrupt a misbehaving plugin.
This is a deliberate consequence of the cdylib + in-process architecture: plugin code runs synchronously on the host's calling thread, and Rust cannot safely interrupt a thread mid-FFI-call. Any honest timeout implementation requires running the plugin in a separate, killable process — out of scope for the current framework.
If your threat model includes runaway plugins, you must add a watchdog yourself. The usual pattern is to run the host process itself with a supervisor that can SIGKILL it on deadline; per-call timeouts inside a single host process are not safely achievable for arbitrary plugin code.
Future work: the fidius-python initiative is the natural carrier for
a real subprocess-isolated execution tier, which would be the only path
by which fidius could grow first-class timeout semantics.