pub struct MiddlewareStack { /* private fields */ }
Expand description
Middleware stack for composing multiple middleware
Implementations§
Source§impl MiddlewareStack
impl MiddlewareStack
Sourcepub fn with_config(config: StackConfig) -> Self
pub fn with_config(config: StackConfig) -> Self
Create a stack with configuration
Sourcepub fn add<M>(&mut self, middleware: M)where
M: Middleware + 'static,
pub fn add<M>(&mut self, middleware: M)where
M: Middleware + 'static,
Add middleware to the stack
Sourcepub async fn process_request(
&self,
request: JsonRpcRequest,
ctx: RequestContext,
) -> ServerResult<(JsonRpcRequest, RequestContext)>
pub async fn process_request( &self, request: JsonRpcRequest, ctx: RequestContext, ) -> ServerResult<(JsonRpcRequest, RequestContext)>
Process request through all middleware
Sourcepub async fn process_response(
&self,
response: JsonRpcResponse,
ctx: &RequestContext,
) -> ServerResult<JsonRpcResponse>
pub async fn process_response( &self, response: JsonRpcResponse, ctx: &RequestContext, ) -> ServerResult<JsonRpcResponse>
Process response through all middleware (in reverse order)
Sourcepub fn list_middleware(&self) -> Vec<&str>
pub fn list_middleware(&self) -> Vec<&str>
List all middleware names
Trait Implementations§
Source§impl Debug for MiddlewareStack
impl Debug for MiddlewareStack
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