pub struct MiddlewareStack { /* private fields */ }Expand description
A stack of middleware with builder pattern.
This is a more ergonomic wrapper around MiddlewareChain.
Implementations§
Source§impl MiddlewareStack
impl MiddlewareStack
Sourcepub fn with<M: Middleware + 'static>(self, middleware: M) -> Self
pub fn with<M: Middleware + 'static>(self, middleware: M) -> Self
Add middleware to the stack (builder pattern).
Sourcepub fn push<M: Middleware + 'static>(&mut self, middleware: M) -> &mut Self
pub fn push<M: Middleware + 'static>(&mut self, middleware: M) -> &mut Self
Add middleware mutably.
Sourcepub fn prepend<M: Middleware + 'static>(&mut self, middleware: M) -> &mut Self
pub fn prepend<M: Middleware + 'static>(&mut self, middleware: M) -> &mut Self
Add middleware to the front of the stack.
Sourcepub fn into_chain(self) -> MiddlewareChain
pub fn into_chain(self) -> MiddlewareChain
Get the underlying chain.
Sourcepub fn execute<'a, F>(
&'a self,
ctx: QueryContext,
final_handler: F,
) -> BoxFuture<'a, MiddlewareResult<QueryResponse>>
pub fn execute<'a, F>( &'a self, ctx: QueryContext, final_handler: F, ) -> BoxFuture<'a, MiddlewareResult<QueryResponse>>
Execute the stack with a final handler.
Trait Implementations§
Source§impl Default for MiddlewareStack
impl Default for MiddlewareStack
Source§impl From<MiddlewareStack> for MiddlewareChain
impl From<MiddlewareStack> for MiddlewareChain
Source§fn from(stack: MiddlewareStack) -> Self
fn from(stack: MiddlewareStack) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for MiddlewareStack
impl !RefUnwindSafe for MiddlewareStack
impl Send for MiddlewareStack
impl Sync for MiddlewareStack
impl Unpin for MiddlewareStack
impl !UnwindSafe for MiddlewareStack
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