pub struct LossMonitor { /* private fields */ }Expand description
Rolling packet-loss estimator over the last 64 resolved packets.
Tracks outcomes (acked vs lost) for PacketType::Data packets only;
heartbeats and other non-data packets are excluded by the caller.
O(1) record and O(1) query. Memory cost: 64 bytes + 3 words.
Implementations§
Source§impl LossMonitor
impl LossMonitor
Sourcepub fn record_acked(&mut self)
pub fn record_acked(&mut self)
Records that a packet was acknowledged (not lost).
Sourcepub fn record_lost(&mut self)
pub fn record_lost(&mut self)
Records that a packet was lost (not acknowledged).
Sourcepub fn packet_loss_pct(&self) -> f32
pub fn packet_loss_pct(&self) -> f32
Fraction of tracked packets that were lost (0.0–1.0). Returns 0.0 if no packets have been tracked yet.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LossMonitor
impl RefUnwindSafe for LossMonitor
impl Send for LossMonitor
impl Sync for LossMonitor
impl Unpin for LossMonitor
impl UnsafeUnpin for LossMonitor
impl UnwindSafe for LossMonitor
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