Skip to main content

AsyncMiddleware

Trait AsyncMiddleware 

Source
pub trait AsyncMiddleware: Send + Sync {
    // Required method
    fn process<'a>(
        &'a self,
        request: &'a mut Request,
        next: AsyncNext<'a>,
    ) -> Pin<Box<dyn Future<Output = Result<Response, HttpError>> + Send + 'a>>;
}
Expand description

Layer that may inspect or mutate the request, then await AsyncNext::run.

Required Methods§

Source

fn process<'a>( &'a self, request: &'a mut Request, next: AsyncNext<'a>, ) -> Pin<Box<dyn Future<Output = Result<Response, HttpError>> + Send + 'a>>

Runs this layer. Call next.run(request).await to continue the pipeline.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§