pub struct ConnectionStats { /* private fields */ }Expand description
Snapshot handle for per-connection counters.
Frame counters are updated when frames are decoded or encoded. With manual
flush semantics, frames_written can increase before bytes_written
because encoded frames may remain buffered until flush or
write_and_flush sends them.
Cloning this handle is cheap. Counter reads use relaxed atomics and are intended for monitoring, not synchronization.
Implementations§
Source§impl ConnectionStats
impl ConnectionStats
Sourcepub fn connected_at(&self) -> Instant
pub fn connected_at(&self) -> Instant
Instant when the connection stats were created.
Sourcepub fn bytes_read(&self) -> u64
pub fn bytes_read(&self) -> u64
Total bytes read from the socket.
Sourcepub fn bytes_written(&self) -> u64
pub fn bytes_written(&self) -> u64
Total bytes written to the socket.
Sourcepub fn frames_read(&self) -> u64
pub fn frames_read(&self) -> u64
Total decoded frames.
Sourcepub fn frames_written(&self) -> u64
pub fn frames_written(&self) -> u64
Total encoded frames.
This counts frames encoded into the write buffer, not necessarily frames already flushed to the socket.
Trait Implementations§
Source§impl Clone for ConnectionStats
impl Clone for ConnectionStats
Source§fn clone(&self) -> ConnectionStats
fn clone(&self) -> ConnectionStats
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ConnectionStats
impl RefUnwindSafe for ConnectionStats
impl Send for ConnectionStats
impl Sync for ConnectionStats
impl Unpin for ConnectionStats
impl UnsafeUnpin for ConnectionStats
impl UnwindSafe for ConnectionStats
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