Struct gotham::pipeline::PipelineBuilder
source · pub struct PipelineBuilder<T>where
T: NewMiddlewareChain,{ /* private fields */ }
Expand description
Allows a pipeline to be defined by adding NewMiddleware
values, and building a Pipeline
.
Examples
new_pipeline()
.add(MiddlewareOne)
.add(MiddlewareTwo)
.add(MiddlewareThree)
.build();
The pipeline defined here is invoked in this order:
(&mut state)
→ MiddlewareOne
→ MiddlewareTwo
→ MiddlewareThree
→
handler
(provided later, when building the router)
Implementations§
source§impl<T> PipelineBuilder<T>where
T: NewMiddlewareChain,
impl<T> PipelineBuilder<T>where
T: NewMiddlewareChain,
sourcepub fn build(self) -> Pipeline<T>where
T: NewMiddlewareChain,
pub fn build(self) -> Pipeline<T>where
T: NewMiddlewareChain,
Builds a Pipeline
, which contains all middleware in the order provided via add
and is
ready to process requests via a NewHandler
provided to Pipeline::call
.
sourcepub fn add<M>(self, m: M) -> PipelineBuilder<(M, T)>where
M: NewMiddleware,
M::Instance: Send + 'static,
Self: Sized,
pub fn add<M>(self, m: M) -> PipelineBuilder<(M, T)>where
M: NewMiddleware,
M::Instance: Send + 'static,
Self: Sized,
Adds a NewMiddleware
which will create a Middleware
during request dispatch.