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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more