pub struct MiddlewareChain { /* private fields */ }Expand description
Ordered chain of middleware layers.
Implementations§
Source§impl MiddlewareChain
impl MiddlewareChain
Sourcepub fn add(&mut self, middleware: impl Middleware)
pub fn add(&mut self, middleware: impl Middleware)
Add a middleware layer to the chain.
Sourcepub async fn process_request(
&self,
request: &JsonRpcRequest,
ctx: &mut RequestContext,
) -> Result<(), JsonRpcError>
pub async fn process_request( &self, request: &JsonRpcRequest, ctx: &mut RequestContext, ) -> Result<(), JsonRpcError>
Run all middleware on the request, stopping on first reject.
Sourcepub async fn process_response(
&self,
response: &mut JsonRpcResponse,
ctx: &RequestContext,
)
pub async fn process_response( &self, response: &mut JsonRpcResponse, ctx: &RequestContext, )
Run all middleware on the response.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MiddlewareChain
impl !RefUnwindSafe for MiddlewareChain
impl Send for MiddlewareChain
impl Sync for MiddlewareChain
impl Unpin for MiddlewareChain
impl UnsafeUnpin for MiddlewareChain
impl !UnwindSafe for MiddlewareChain
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