Trait sfo_http::http_server::Middleware
source · pub trait Middleware<State>: Send + Sync + 'static {
// Required method
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
request: Request<State>,
next: Next<'life1, State>
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided method
fn name(&self) -> &str { ... }
}Expand description
Middleware that wraps around the remaining middleware chain.
Required Methods§
sourcefn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
request: Request<State>,
next: Next<'life1, State>
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>( &'life0 self, request: Request<State>, next: Next<'life1, State> ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Asynchronously handle the request, and return a response.