Expand description
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.
Re-exports§
pub use fidius_core::inventory;
Modules§
- descriptor
- FFI descriptor and registry types for the Fidius plugin framework.
- error
- Error types for the Fidius plugin framework.
- hash
- FNV-1a interface hashing for compile-time ABI drift detection.
- python_
descriptor - Compile-time descriptor of a fidius interface used by the Python loader.
- registry
- Plugin registry assembly for multi-plugin dylibs.
- status
- FFI status codes returned by plugin method shims.
- stream_
ffi - cdylib server-streaming FFI handle (FIDIUS-I-0026 Phase 3 / CS.1, T-0138).
- stream_
marker - The
fidius::Stream<T>server-streaming return marker (FIDIUS-I-0026, D4). - wasm_
descriptor - Compile-time descriptor of a fidius interface used by the WASM loader.
- wire
- Wire format serialization for Fidius plugin FFI boundary.
Macros§
- fidius_
plugin_ registry - Emit the
fidius_get_registryexport function.
Structs§
- Plugin
Descriptor - Metadata descriptor for a single plugin within a dylib.
- Plugin
Error - Error returned by plugin method implementations to signal business logic failures.
- Plugin
Registry - Top-level registry exported by every Fidius plugin dylib.
- Stream
- The
fidius::Stream<T>server-streaming return marker — write it as a method’s return type in a#[plugin_interface]trait to declare a server-streaming method. Seefidius_core::stream_marker::Stream. Marker type a plugin interface uses to declare a server-streaming method: - Value
Error - The neutral value model + (de)serialization helpers host consumers use to
decode
ChunkStreamitems and dynamicValues. Error produced while converting to or fromValue.
Enums§
- Buffer
Strategy Kind - Buffer management strategy for an interface.
- Value
- The neutral value model + (de)serialization helpers host consumers use to
decode
ChunkStreamitems and dynamicValues. A self-describing value crossing the plugin-call boundary.
Constants§
- ABI_
VERSION - Current version of the
PluginDescriptorstruct layout. Derived from thefidius-corecrate version per ADR-0002. - FIDIUS_
MAGIC - Magic bytes identifying a Fidius plugin registry.
- REGISTRY_
VERSION - Current version of the
PluginRegistrystruct layout.
Functions§
- fnv1a
- Compute the FNV-1a 64-bit hash of a byte slice.
- from_
value - The neutral value model + (de)serialization helpers host consumers use to
decode
ChunkStreamitems and dynamicValues. Convert aValueinto anyDeserializetype. - interface_
hash - Compute the interface hash from a set of method signatures.
- to_
value - The neutral value model + (de)serialization helpers host consumers use to
decode
ChunkStreamitems and dynamicValues. Convert anySerializetype into aValue.
Attribute Macros§
- plugin_
impl - Implement a plugin interface for a concrete type.
- plugin_
interface - Define a plugin interface from a trait.