pub trait Middleware: Send + Sync {
// Provided methods
fn before_execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_req: &'life1 ToolRequest,
) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn after_execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 ToolRequest,
_res: &'life2 ToolResponse,
) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn on_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 ToolRequest,
_err: &'life2 UnifiedToolError,
) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Middleware trait for intercepting tool execution.
Provided Methods§
Sourcefn before_execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_req: &'life1 ToolRequest,
) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_req: &'life1 ToolRequest,
) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called before tool execution.
Sourcefn after_execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 ToolRequest,
_res: &'life2 ToolResponse,
) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn after_execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 ToolRequest,
_res: &'life2 ToolResponse,
) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called after successful execution.
Sourcefn on_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 ToolRequest,
_err: &'life2 UnifiedToolError,
) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 ToolRequest,
_err: &'life2 UnifiedToolError,
) -> Pin<Box<dyn Future<Output = MiddlewareResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called on execution error.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".