pub struct SocketTools {
pub socket_addr: SocketAddr,
pub id: u64,
/* private fields */
}Available on crate feature
server only.Expand description
A struct for sending packets, measuring latency, and managing the SocketTools object.
Fields§
§socket_addr: SocketAddrThe socket address.
id: u64The ID of the SocketTools object.
Implementations§
Source§impl SocketTools
impl SocketTools
Sourcepub fn send_data(&self, bytes: ContainerBytes)
pub fn send_data(&self, bytes: ContainerBytes)
Sends bytes (Packet) to the session.
Sourcepub fn write_data(&self, bytes: ContainerBytes)
pub fn write_data(&self, bytes: ContainerBytes)
Writes bytes (Packet) to the session.
Sourcepub fn get_latency(&self) -> i64
pub fn get_latency(&self) -> i64
Returns the latency of the connection.
Sourcepub fn close_with_delay(&self, delay: Duration) -> Result<()>
pub fn close_with_delay(&self, delay: Duration) -> Result<()>
Closes the session with a delay.
Trait Implementations§
Source§impl Clone for SocketTools
impl Clone for SocketTools
Source§impl Debug for SocketTools
impl Debug for SocketTools
impl Eq for SocketTools
Source§impl PartialEq for SocketTools
impl PartialEq for SocketTools
Auto Trait Implementations§
impl !Freeze for SocketTools
impl RefUnwindSafe for SocketTools
impl Send for SocketTools
impl Sync for SocketTools
impl Unpin for SocketTools
impl UnsafeUnpin for SocketTools
impl UnwindSafe for SocketTools
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.