pub trait Middleware: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn phases(&self) -> Vec<MiddlewarePhase>;
fn handle<'a>(
&'a self,
ctx: &'a MiddlewareContext,
) -> Pin<Box<dyn Future<Output = MiddlewareResult> + Send + 'a>>;
}Expand description
Middleware trait — implement this to add behavior to the agent pipeline.
Required Methods§
Sourcefn phases(&self) -> Vec<MiddlewarePhase>
fn phases(&self) -> Vec<MiddlewarePhase>
Phases at which this middleware wishes to be invoked.
Sourcefn handle<'a>(
&'a self,
ctx: &'a MiddlewareContext,
) -> Pin<Box<dyn Future<Output = MiddlewareResult> + Send + 'a>>
fn handle<'a>( &'a self, ctx: &'a MiddlewareContext, ) -> Pin<Box<dyn Future<Output = MiddlewareResult> + Send + 'a>>
Inspect the context for the current phase and return a result.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".