pub struct ProgressSample {
pub progress: Vec<ProgressEntry>,
pub bps: u64,
pub avg_bps: u64,
pub downloaded: u64,
pub percent: f64,
pub total: u64,
pub elapsed: Duration,
pub eta: Option<Duration>,
}Expand description
Computed aggregate view of the current download progress, carried by
Event::Progress.
Fields§
§progress: Vec<ProgressEntry>Already-written byte ranges — the same source of truth used for resume bookkeeping (normalized and de-duplicated).
bps: u64Recent transfer rate in bytes/second, smoothed with an exponential
moving average (time constant ≈ 3s) over the per-interval deltas, so it
tracks real throughput changes within a few seconds without the
sub-second jitter of raw window deltas. 0 on the first emit and on
the final emit.
avg_bps: u64Average transfer rate in bytes/second over the whole download session
(all resume runs combined): total downloaded divided by total
elapsed, so it stays correct across a resume instead of resetting to
zero. 0 while the total elapsed time is still too small to measure.
downloaded: u64Total bytes written so far (the sum of all progress range lengths).
percent: f64Download percentage as a 0.0..=100.0 value (downloaded * 100 / total); 0.0 when total == 0 (an empty file has nothing to
download).
total: u64Remote file size in bytes, so the consumer can derive a percentage without tracking it separately.
elapsed: DurationTotal active download time accumulated across all resume runs,
persisted in the .fd state so a resume continues the clock.
eta: Option<Duration>Estimated time remaining, computed as (total - downloaded) / rate
where rate is the smoothed recent bps (preferred: it reflects the
current link speed, so the estimate stays honest after a resume at a
different speed), falling back to avg_bps while bps is still zero.
None until a rate can be measured (the very first emit, or a stalled
connection) and Some(Duration::ZERO) once downloaded == total.
Trait Implementations§
Source§impl Clone for ProgressSample
impl Clone for ProgressSample
Source§fn clone(&self) -> ProgressSample
fn clone(&self) -> ProgressSample
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more