pub struct PluginV2Registry { /* private fields */ }Expand description
Runtime registry of Plugin instances with enable/disable support and
per-plugin call statistics.
Implementations§
Source§impl PluginV2Registry
impl PluginV2Registry
Sourcepub fn register(&mut self, plugin: Box<dyn Plugin>)
pub fn register(&mut self, plugin: Box<dyn Plugin>)
Register a plugin. Plugins execute in registration order.
Sourcepub fn disable(&mut self, name: &str)
pub fn disable(&mut self, name: &str)
Disable a plugin by name. Disabled plugins are skipped during
run_request_hooks and run_response_hooks but remain registered.
No-op if the name is not found.
Sourcepub fn enable(&mut self, name: &str)
pub fn enable(&mut self, name: &str)
Re-enable a plugin that was previously disabled.
No-op if the name is not found.
Sourcepub fn list(&self) -> Vec<PluginInfo>
pub fn list(&self) -> Vec<PluginInfo>
List all registered plugins with their current statistics.
Sourcepub fn run_request_hooks(
&mut self,
req: &mut PromptRequest,
) -> Result<(), PluginError>
pub fn run_request_hooks( &mut self, req: &mut PromptRequest, ) -> Result<(), PluginError>
Run on_request for all enabled plugins in registration order.
Stops at the first RequestRejected error, records the error in stats.
Sourcepub fn run_response_hooks(
&mut self,
resp: &mut Vec<String>,
) -> Result<(), PluginError>
pub fn run_response_hooks( &mut self, resp: &mut Vec<String>, ) -> Result<(), PluginError>
Run on_response for all enabled plugins in registration order.
Does not short-circuit on error — all enabled plugins run. The last error encountered is returned, if any.
Trait Implementations§
Source§impl Default for PluginV2Registry
impl Default for PluginV2Registry
Source§fn default() -> PluginV2Registry
fn default() -> PluginV2Registry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for PluginV2Registry
impl !UnwindSafe for PluginV2Registry
impl Freeze for PluginV2Registry
impl Send for PluginV2Registry
impl Sync for PluginV2Registry
impl Unpin for PluginV2Registry
impl UnsafeUnpin for PluginV2Registry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request