distant_net/server/
context.rs

1use std::fmt;
2
3use super::ServerReply;
4use crate::common::{ConnectionId, Request};
5
6/// Represents contextual information for working with an inbound request.
7pub struct RequestCtx<T, U> {
8    /// Unique identifer associated with the connection that sent the request.
9    pub connection_id: ConnectionId,
10
11    /// The request being handled.
12    pub request: Request<T>,
13
14    /// Used to send replies back to be sent out by the server.
15    pub reply: ServerReply<U>,
16}
17
18impl<T, U> fmt::Debug for RequestCtx<T, U>
19where
20    T: fmt::Debug,
21{
22    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23        f.debug_struct("RequestCtx")
24            .field("connection_id", &self.connection_id)
25            .field("request", &self.request)
26            .field("reply", &"...")
27            .finish()
28    }
29}