Skip to main content

ContextData

Struct ContextData 

Source
pub struct ContextData { /* private fields */ }
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.

Implementations§

Source§

impl ContextData

Implementation of methods for ContextData.

Source

pub fn new( socket: ArcRwLockUdpSocket, request: Request, client_addr: SocketAddr, ) -> Self

Creates a new ContextData with the given socket, request, and client address.

§Arguments
  • ArcRwLockUdpSocket - The network socket.
  • Request - The request data.
  • SocketAddr - The client’s socket address.
§Returns
  • Self - A new ContextData instance.
Source

pub fn get_aborted(&self) -> bool

Gets the aborted flag.

§Returns
  • bool - The aborted flag.
Source

pub fn set_aborted(&mut self, aborted: bool)

Sets the aborted flag.

§Arguments
  • bool - The new value for the aborted flag.
Source

pub fn get_socket(&self) -> Option<ArcRwLockUdpSocket>

Gets the socket.

§Returns
  • Option<ArcRwLockUdpSocket> - The socket if present.
Source

pub fn get_request(&self) -> &Request

Gets the request.

§Returns
  • &Request - Reference to the request.
Source

pub fn get_response(&self) -> &Response

Gets the response.

§Returns
  • &Response - Reference to the response.
Source

pub fn get_response_mut(&mut self) -> &mut Response

Gets the response mutably.

§Returns
  • &mut Response - Mutable reference to the response.
Source

pub fn get_client_addr(&self) -> Option<SocketAddr>

Gets the client address.

§Returns
  • Option<SocketAddr> - The client address if present.
Source

pub fn get_attributes(&self) -> &ThreadSafeAttributeStore

Gets the attributes.

§Returns
  • &ThreadSafeAttributeStore - Reference to the attributes.
Source

pub fn get_attributes_mut(&mut self) -> &mut ThreadSafeAttributeStore

Gets the attributes mutably.

§Returns
  • &mut ThreadSafeAttributeStore - Mutable reference to the attributes.

Trait Implementations§

Source§

impl Clone for ContextData

Source§

fn clone(&self) -> ContextData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ContextData

Provides a default implementation for ContextData.

Source§

fn default() -> Self

Creates a default ContextData with empty values.

§Returns
  • Self - A new instance with default values.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AnySendSyncClone for T
where T: Any + Send + Sync + Clone,