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> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: '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> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
request: Request<State>,
next: Next<'life1, State>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Asynchronously handle the request, and return a response.