pub struct ContextData {
pub aborted: bool,
pub socket: Option<ArcRwLockUdpSocket>,
pub request: Request,
pub response: Response,
pub client_addr: Option<SocketAddr>,
pub attributes: ThreadSafeAttributeStore,
}Expand description
Represents the internal state of the application context.
This structure holds all the data associated with a single request-response cycle, including the socket, request, response, and any custom attributes.
Accessors are generated by #[derive(Data)]; Copy fields return values and
the optional socket returns an owned Option clone via type(...) hints.
Fields§
§aborted: boolA flag indicating whether the request handling has been aborted.
socket: Option<ArcRwLockUdpSocket>The underlying network socket for the connection.
request: RequestThe incoming UDP request data.
response: ResponseThe outgoing UDP response data.
client_addr: Option<SocketAddr>The client’s socket address.
attributes: ThreadSafeAttributeStoreA collection of custom attributes for sharing data within the request lifecycle.
Implementations§
Source§impl ContextData
Implementation of methods for ContextData.
impl ContextData
Implementation of methods for ContextData.
Sourcepub fn new(
socket: ArcRwLockUdpSocket,
request: Request,
client_addr: SocketAddr,
) -> Self
pub fn new( socket: ArcRwLockUdpSocket, request: Request, client_addr: SocketAddr, ) -> Self
Source§impl ContextData
impl ContextData
pub fn get_aborted(&self) -> bool
pub fn get_mut_aborted(&mut self) -> &mut bool
pub fn set_aborted(&mut self, val: bool) -> &mut Self
pub fn get_socket(&self) -> Option<ArcRwLockUdpSocket>
pub fn try_get_socket(&self) -> Option<ArcRwLockUdpSocket>
pub fn get_mut_socket(&mut self) -> &mut Option<ArcRwLockUdpSocket>
pub fn set_socket(&mut self, val: Option<ArcRwLockUdpSocket>) -> &mut Self
pub fn get_request(&self) -> &Request
pub fn get_mut_request(&mut self) -> &mut Request
pub fn set_request(&mut self, val: Request) -> &mut Self
pub fn get_response(&self) -> &Response
pub fn get_mut_response(&mut self) -> &mut Response
pub fn set_response(&mut self, val: Response) -> &mut Self
pub fn get_client_addr(&self) -> Option<SocketAddr>
pub fn try_get_client_addr(&self) -> Option<SocketAddr>
pub fn get_mut_client_addr(&mut self) -> &mut Option<SocketAddr>
pub fn set_client_addr(&mut self, val: Option<SocketAddr>) -> &mut Self
pub fn get_attributes(&self) -> &ThreadSafeAttributeStore
pub fn get_mut_attributes(&mut self) -> &mut ThreadSafeAttributeStore
pub fn set_attributes(&mut self, val: ThreadSafeAttributeStore) -> &mut Self
Trait Implementations§
Source§impl Clone for ContextData
impl Clone for ContextData
Auto Trait Implementations§
impl !RefUnwindSafe for ContextData
impl !UnwindSafe for ContextData
impl Freeze for ContextData
impl Send for ContextData
impl Sync for ContextData
impl Unpin for ContextData
impl UnsafeUnpin for ContextData
Blanket Implementations§
impl<T> AnySendSyncClone for T
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