pub struct ConnectionStats {
pub connected_at: Instant,
pub bytes_received: u64,
pub bytes_sent: u64,
pub requests_processed: u32,
pub is_active: bool,
}Expand description
Statistics for a connection session.
This struct tracks various metrics about a connection’s lifecycle and can be used for monitoring, debugging, and performance analysis.
Fields§
§connected_at: InstantWhen the connection was established
bytes_received: u64Total bytes received on this connection
bytes_sent: u64Total bytes sent on this connection
requests_processed: u32Number of requests processed on this connection
is_active: boolWhether the connection is still active
Implementations§
Source§impl ConnectionStats
impl ConnectionStats
Sourcepub fn connection_duration(&self) -> Duration
pub fn connection_duration(&self) -> Duration
Returns the duration since the connection was established.
Sourcepub fn record_bytes_received(&mut self, bytes: u64)
pub fn record_bytes_received(&mut self, bytes: u64)
Records bytes received on the connection.
Sourcepub fn record_bytes_sent(&mut self, bytes: u64)
pub fn record_bytes_sent(&mut self, bytes: u64)
Records bytes sent on the connection.
Sourcepub fn record_request(&mut self)
pub fn record_request(&mut self)
Records a completed request.
Sourcepub fn mark_closed(&mut self)
pub fn mark_closed(&mut self)
Marks the connection as closed.
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 moreSource§impl Debug for ConnectionStats
impl Debug for ConnectionStats
Auto 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