pub struct Middlewares { /* private fields */ }
Expand description
The middleware chain which can append other middlewares.
This is a canonical implementation of Iron’s middleware system, but Iron’s infrastructure is flexible enough to allow alternate systems.
Implementations§
Source§impl Middlewares
impl Middlewares
Sourcepub fn new<H>(handler: H) -> Selfwhere
H: Handler,
pub fn new<H>(handler: H) -> Selfwhere
H: Handler,
Construct a new middleware chain from a Handler
.
Sourcepub fn link<B, A>(&mut self, link: (B, A)) -> &mut Middlewareswhere
A: AfterMiddleware,
B: BeforeMiddleware,
pub fn link<B, A>(&mut self, link: (B, A)) -> &mut Middlewareswhere
A: AfterMiddleware,
B: BeforeMiddleware,
Link both a before and after middleware to the chain at once.
Middleware that have a Before and After piece should have a constructor which returns both as a tuple, so it can be passed directly to link.
Sourcepub fn link_before<B>(&mut self, before: B) -> &mut Middlewareswhere
B: BeforeMiddleware,
pub fn link_before<B>(&mut self, before: B) -> &mut Middlewareswhere
B: BeforeMiddleware,
Link a BeforeMiddleware
to the Middlewares
chain, after all previously linked
BeforeMiddleware
s.
Sourcepub fn link_after<A>(&mut self, after: A) -> &mut Middlewareswhere
A: AfterMiddleware,
pub fn link_after<A>(&mut self, after: A) -> &mut Middlewareswhere
A: AfterMiddleware,
Link a AfterMiddleware
to the Middlewares
chain, after all previously linked
AfterMiddleware
s.
Sourcepub async fn link_around<A>(&mut self, around: A) -> &mut Middlewareswhere
A: AroundMiddleware,
pub async fn link_around<A>(&mut self, around: A) -> &mut Middlewareswhere
A: AroundMiddleware,
Apply an AroundMiddleware
to the Handler
in this Middlewares
chain.
Trait Implementations§
Source§impl Handler for Middlewares
impl Handler for Middlewares
Auto Trait Implementations§
impl Freeze for Middlewares
impl !RefUnwindSafe for Middlewares
impl Send for Middlewares
impl Sync for Middlewares
impl Unpin for Middlewares
impl !UnwindSafe for Middlewares
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more