pub trait Plugin:
Send
+ Sync
+ 'static {
const CAPABILITY: Option<&'static str> = None;
// Required methods
fn create<'async_trait>(
context: PluginContext,
) -> Pin<Box<dyn Future<Output = Result<Self, String>> + Send + 'async_trait>>
where Self: Sized + 'async_trait;
fn register<R: PluginRegistry + ?Sized>(self: Arc<Self>, registry: &mut R)
where Self: Sized;
}Provided Associated Constants§
Sourceconst CAPABILITY: Option<&'static str> = None
const CAPABILITY: Option<&'static str> = None
Compile-time semantic description of this plugin’s capability for the LLM.
Required Methods§
Sourcefn create<'async_trait>(
context: PluginContext,
) -> Pin<Box<dyn Future<Output = Result<Self, String>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
fn create<'async_trait>(
context: PluginContext,
) -> Pin<Box<dyn Future<Output = Result<Self, String>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
This is the method for instantiating plugins, allowing them to await
their database connections (via context.store::<S>().await) before returning.
Note on Configuration: When calling context.config()? to extract your configuration struct,
ensure any optional fields in your struct are marked with #[serde(default)]. Otherwise,
omitted fields in the config file will cause strict deserialization errors.
fn register<R: PluginRegistry + ?Sized>(self: Arc<Self>, registry: &mut R)where
Self: Sized,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".