Middleware

Trait Middleware 

Source
pub trait Middleware:
    Send
    + Sync
    + Debug {
    // Required method
    fn handle(
        &self,
        request: ElifRequest,
        next: Next,
    ) -> Pin<Box<dyn Future<Output = ElifResponse> + Send>>;

    // Provided method
    fn name(&self) -> &'static str { ... }
}
Expand description

New middleware trait with Laravel-style handle(request, next) pattern Uses boxed futures to be dyn-compatible

Required Methods§

Source

fn handle( &self, request: ElifRequest, next: Next, ) -> Pin<Box<dyn Future<Output = ElifResponse> + Send>>

Handle the request and call the next middleware in the chain

Provided Methods§

Source

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

Optional middleware name for debugging

Implementors§