pub struct LoggingMiddleware;Expand description
A minimal middleware that logs request URIs and response statuses.
This is just a very, very simple example meant for inspiration. It shows how to wrap a request/response cycle inside a middleware layer.
Trait Implementations§
Source§impl Middleware for LoggingMiddleware
impl Middleware for LoggingMiddleware
fn handle<'req, 'life0, 'async_trait>(
&'life0 self,
req: Request<&'req str>,
state: Arc<McpAppState>,
next: Arc<dyn Fn(Request<&'req str>, Arc<McpAppState>) -> BoxFutureResponse<'req> + Send + Sync>,
) -> Pin<Box<dyn Future<Output = TransportServerResult<Response<GenericBody>>> + Send + 'async_trait>>where
Self: 'async_trait,
'req: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for LoggingMiddleware
impl RefUnwindSafe for LoggingMiddleware
impl Send for LoggingMiddleware
impl Sync for LoggingMiddleware
impl Unpin for LoggingMiddleware
impl UnwindSafe for LoggingMiddleware
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