[−][src]Trait amiya::middleware::Middleware
Use your custom type as a middleware by implement this trait.
You need async_trait
to implement this.
See examples/measurer.rs
for a example of process time usage measurer middleware.
Required methods
#[must_use]fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context<'life1, Ex>
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
ctx: Context<'life1, Ex>
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
You middleware's handler function, it will be called when request reach this middleware
Implementors
impl<Ex> Middleware<Ex> for M<Ex> where
Ex: Send + Sync + 'static,
[src]
Ex: Send + Sync + 'static,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context<'life1, Ex>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
ctx: Context<'life1, Ex>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
impl<Ex> Middleware<Ex> for MethodRouter<Ex> where
Ex: Send + Sync + 'static,
[src]
Ex: Send + Sync + 'static,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context<'life1, Ex>
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
ctx: Context<'life1, Ex>
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
impl<Ex> Middleware<Ex> for Router<Ex> where
Ex: Send + Sync + 'static,
[src]
Ex: Send + Sync + 'static,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context<'life1, Ex>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
ctx: Context<'life1, Ex>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,