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
sourceimpl<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.
Auto Trait Implementations
impl<T> RefUnwindSafe for PipelineBuilder<T>
impl<T> Send for PipelineBuilder<T>where
T: Send,
impl<T> Sync for PipelineBuilder<T>where
T: Sync,
impl<T> Unpin for PipelineBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for PipelineBuilder<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more