Skip to main content

AroundMiddleware

Trait AroundMiddleware 

Source
pub trait AroundMiddleware {
    // Required method
    fn around(self, handler: Box<dyn Handler>) -> Box<dyn Handler>;
}
Expand description

AroundMiddleware are used to wrap and replace the Handler in a Chain.

AroundMiddleware produce Handlers through their around method, which is called once on insertion into a Chain or can be called manually outside of a Chain.

Required Methods§

Source

fn around(self, handler: Box<dyn Handler>) -> Box<dyn Handler>

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 a Chain using Chain::around, it is passed the Chain’s current Handler.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> AroundMiddleware for F
where F: FnOnce(Box<dyn Handler>) -> Box<dyn Handler>,