Skip to main content

AsyncMiddleware

Trait AsyncMiddleware 

Source
pub trait AsyncMiddleware: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn execute<'a, 'async_trait>(
        &'a self,
        request: ToolRequest,
        next: Box<dyn Fn(ToolRequest) -> Pin<Box<dyn Future<Output = ToolResult> + Send>> + Send + Sync + 'a>,
    ) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
}
Expand description

Async middleware trait

Required Methods§

Source

fn name(&self) -> &str

Middleware name

Source

fn execute<'a, 'async_trait>( &'a self, request: ToolRequest, next: Box<dyn Fn(ToolRequest) -> Pin<Box<dyn Future<Output = ToolResult> + Send>> + Send + Sync + 'a>, ) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Execute middleware

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§