docs(irtt-stats): Add documentation comments to public-facing types and fields

Add docstrings to clarify the purpose of statistics collection types and describe the units and behaviors of metric fields.
This commit is contained in:
Nils Andreas Svee committed 2026-05-13 15:15:41 +07:00
1 parent 19e0e7aab9
commit a180388dc6
3 files changed
+114 -3

No files matched your search

+14
View File
@@ -1,15 +1,29 @@
use crate::PacketCounts;
#[derive(Debug, Clone, Copy, PartialEq)]
/// Packet loss, duplicate, and late-packet statistics.
///
/// Percentage fields are percentages from `0.0` to `100.0` in normal cases.
/// Directional upstream and downstream loss can be negative when
/// server-reported counts exceed local expectations.
pub struct LossStats {
/// Locally inferred lost packets.
pub lost_packets: u64,
/// Loss not attributed to a direction.
pub unknown_loss_packets: u64,
/// Server-assisted upstream loss estimate, when server counts are available.
pub upstream_loss_packets: Option<i128>,
/// Server-assisted downstream loss estimate, when server counts are available.
pub downstream_loss_packets: Option<i128>,
/// Total packet loss percentage.
pub packet_loss_percent: f64,
/// Server-assisted upstream loss percentage.
pub upstream_loss_percent: f64,
/// Server-assisted downstream loss percentage.
pub downstream_loss_percent: f64,
/// Duplicate reply percentage.
pub duplicate_percent: f64,
/// Late reply packet percentage.
pub late_packets_percent: f64,
}