Struct iron::middleware::Chain
[−]
[src]
pub struct Chain { // some fields omitted }
The middleware chain used in Iron.
This is a canonical implementation of Iron's middleware system, but Iron's infrastructure is flexible enough to allow alternate systems.
Methods
impl Chain
fn new<H: Handler>(handler: H) -> Chain
Construct a new ChainBuilder from a Handler
.
fn link<B, A>(&mut self, link: (B, A)) -> &mut Chain where 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.
fn link_before<B>(&mut self, before: B) -> &mut Chain where B: BeforeMiddleware
Link a BeforeMiddleware
to the Chain
, after all previously linked
BeforeMiddleware
.
fn link_after<A>(&mut self, after: A) -> &mut Chain where A: AfterMiddleware
Link a AfterMiddleware
to the Chain
, after all previously linked
AfterMiddleware
.
fn around<A>(&mut self, around: A) -> &mut Chain where A: AroundMiddleware
Apply an AroundMiddleware
to the Handler
in this Chain
.