pub struct Context(/* private fields */);Expand description
Thread-safe context wrapper for UDP operations.
Provides synchronized access to the inner context.
Implementations§
Source§impl Context
Implementation of Context methods.
impl Context
Implementation of Context methods.
Provides thread-safe operations on the UDP context.
Sourcepub async fn get_read_lock(&self) -> RwLockReadContext<'_>
pub async fn get_read_lock(&self) -> RwLockReadContext<'_>
Acquires a read lock on the inner context.
§Returns
RwLockReadContext- Read guard for the inner context.
Sourcepub async fn get_write_lock(&self) -> RwLockWriteContext<'_>
pub async fn get_write_lock(&self) -> RwLockWriteContext<'_>
Acquires a write lock on the inner context.
§Returns
RwLockWriteContext- Write guard for the inner context.
Sourcepub async fn get(&self) -> InnerContext
pub async fn get(&self) -> InnerContext
Sourcepub async fn get_request(&self) -> Request
pub async fn get_request(&self) -> Request
Sourcepub async fn get_response(&self) -> Response
pub async fn get_response(&self) -> Response
Sourcepub async fn get_socket(&self) -> OptionArcRwLockUdpSocket
pub async fn get_socket(&self) -> OptionArcRwLockUdpSocket
Gets the UDP socket from the context.
§Returns
OptionArcRwLockUdpSocket- Clone of the socket if present.
Sourcepub async fn get_socket_addr(&self) -> OptionSocketAddr
pub async fn get_socket_addr(&self) -> OptionSocketAddr
Gets the socket address from the context.
§Returns
OptionSocketAddr- Clone of the socket address if present.
Sourcepub async fn get_socket_addr_or_default(&self) -> SocketAddr
pub async fn get_socket_addr_or_default(&self) -> SocketAddr
Gets the socket address or default if not present.
§Returns
SocketAddr- Socket address or default (0.0.0.0:0).
Sourcepub async fn get_socket_addr_string(&self) -> Option<String>
pub async fn get_socket_addr_string(&self) -> Option<String>
Sourcepub async fn get_socket_addr_or_default_string(&self) -> String
pub async fn get_socket_addr_or_default_string(&self) -> String
Sourcepub async fn get_socket_host(&self) -> OptionSocketHost
pub async fn get_socket_host(&self) -> OptionSocketHost
Sourcepub async fn get_socket_port(&self) -> OptionSocketPort
pub async fn get_socket_port(&self) -> OptionSocketPort
Sourcepub async fn send<T: Into<ResponseData>>(&self, data: T) -> ResponseResult
pub async fn send<T: Into<ResponseData>>(&self, data: T) -> ResponseResult
Sourcepub async fn set_data_value<T: Any + Send + Sync + Clone>(
&self,
key: &str,
value: &T,
) -> &Self
pub async fn set_data_value<T: Any + Send + Sync + Clone>( &self, key: &str, value: &T, ) -> &Self
Sourcepub async fn remove_data_value(&self, key: &str) -> &Self
pub async fn remove_data_value(&self, key: &str) -> &Self
Sourcepub async fn clear_data(&self) -> &Self
pub async fn clear_data(&self) -> &Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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