pub trait AroundMiddleware {
// Required method
fn around<'async_trait>(
self,
handler: Box<dyn Handler>,
) -> Pin<Box<dyn Future<Output = Box<dyn Handler>> + 'async_trait>>
where Self: 'async_trait;
}Expand description
AroundMiddleware are used to wrap and replace the Handler in the Middlewares chain.
AroundMiddleware produce Handlers through their around method, which is
called once on insertion into the Middlewares chain or can be called manually outside of a
Middlewares chain.
Required Methods§
Sourcefn around<'async_trait>(
self,
handler: Box<dyn Handler>,
) -> Pin<Box<dyn Future<Output = Box<dyn Handler>> + 'async_trait>>where
Self: 'async_trait,
fn around<'async_trait>(
self,
handler: Box<dyn Handler>,
) -> Pin<Box<dyn Future<Output = Box<dyn Handler>> + 'async_trait>>where
Self: 'async_trait,
Produce a Handler from this AroundMiddleware given another Handler.
Usually this means wrapping the handler and editing the Request on the
way in and the Response on the way out.
This is called only once, when an AroundMiddleware is added to the Middlewares chain
using Middlewares::around, it is passed the Middlewares chain’s current Handler.