pub struct MiddlewareChain { /* private fields */ }
Expand description
Middleware chain for composing multiple middleware
Implementations§
Source§impl MiddlewareChain
impl MiddlewareChain
Sourcepub fn with_middleware(self, middleware: Arc<dyn ProtocolMiddleware>) -> Self
pub fn with_middleware(self, middleware: Arc<dyn ProtocolMiddleware>) -> Self
Add middleware to the chain
Sourcepub async fn process_request(&self, request: &mut ProtocolRequest) -> Result<()>
pub async fn process_request(&self, request: &mut ProtocolRequest) -> Result<()>
Process a request through all middleware
Sourcepub async fn process_response(
&self,
request: &ProtocolRequest,
response: &mut ProtocolResponse,
) -> Result<()>
pub async fn process_response( &self, request: &ProtocolRequest, response: &mut ProtocolResponse, ) -> Result<()>
Process a response through all middleware (in reverse order)
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 !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