pub struct MiddlewareChain { /* private fields */ }Expand description
A chain of middleware that processes queries.
The chain executes middleware in order, with each middleware able to:
- Modify the query context before passing to the next
- Modify the response after receiving from the next
- Short-circuit by not calling next
Implementations§
Source§impl MiddlewareChain
impl MiddlewareChain
Sourcepub fn with(middlewares: Vec<Arc<dyn Middleware>>) -> Self
pub fn with(middlewares: Vec<Arc<dyn Middleware>>) -> Self
Create a chain with initial middleware.
Sourcepub fn push<M: Middleware + 'static>(&mut self, middleware: M)
pub fn push<M: Middleware + 'static>(&mut self, middleware: M)
Add middleware to the end of the chain.
Sourcepub fn prepend<M: Middleware + 'static>(&mut self, middleware: M)
pub fn prepend<M: Middleware + 'static>(&mut self, middleware: M)
Add middleware to the beginning of the 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 middleware chain.
Trait Implementations§
Source§impl Default for MiddlewareChain
impl Default for MiddlewareChain
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 MiddlewareChain
impl !RefUnwindSafe for MiddlewareChain
impl Send for MiddlewareChain
impl Sync for MiddlewareChain
impl Unpin for MiddlewareChain
impl !UnwindSafe for MiddlewareChain
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more