pub struct LinkStats {
pub packets_sent: u64,
pub packets_recv: u64,
pub bytes_sent: u64,
pub bytes_recv: u64,
pub last_recv_ms: u64,
pub loss_rate: f32,
pub throughput_estimate: u64,
/* private fields */
}Expand description
Statistics for a link.
Fields§
§packets_sent: u64Total packets sent.
packets_recv: u64Total packets received.
bytes_sent: u64Total bytes sent.
bytes_recv: u64Total bytes received.
last_recv_ms: u64Timestamp of last received packet (Unix milliseconds).
loss_rate: f32Observed packet loss rate (0.0-1.0).
throughput_estimate: u64Estimated throughput in bytes/second.
Implementations§
Source§impl LinkStats
impl LinkStats
Sourcepub fn record_sent(&mut self, bytes: usize)
pub fn record_sent(&mut self, bytes: usize)
Record a sent packet.
Sourcepub fn record_recv(&mut self, bytes: usize, timestamp_ms: u64)
pub fn record_recv(&mut self, bytes: usize, timestamp_ms: u64)
Record a received packet.
Sourcepub fn rtt_estimate(&self) -> Option<Duration>
pub fn rtt_estimate(&self) -> Option<Duration>
Get the RTT estimate, if available.
Sourcepub fn update_rtt(&mut self, rtt: Duration)
pub fn update_rtt(&mut self, rtt: Duration)
Update RTT estimate from a probe response.
Uses exponential moving average with alpha=0.2.
Sourcepub fn time_since_recv(&self, current_time_ms: u64) -> u64
pub fn time_since_recv(&self, current_time_ms: u64) -> u64
Time since last receive (for keepalive/timeout).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LinkStats
impl RefUnwindSafe for LinkStats
impl Send for LinkStats
impl Sync for LinkStats
impl Unpin for LinkStats
impl UnsafeUnpin for LinkStats
impl UnwindSafe for LinkStats
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more