Trait HttpMiddleware

Source
pub trait HttpMiddleware: Send + Sync {
    // Required method
    fn name(&self) -> &'static str;

    // Provided methods
    fn before<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 mut Request,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn after<'life0, 'life1, 'async_trait>(
        &'life0 self,
        response: &'life1 mut Response,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn priority(&self) -> i32 { ... }
}
Expand description

Trait for HTTP middleware

Required Methods§

Source

fn name(&self) -> &'static str

Middleware name

Provided Methods§

Source

fn before<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 mut Request, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Processes the request before it reaches the handler

Source

fn after<'life0, 'life1, 'async_trait>( &'life0 self, response: &'life1 mut Response, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Processes the response after the handler

Source

fn priority(&self) -> i32

Middleware priority (lower runs first)

Implementors§