unistore_progress/
config.rs1use crate::deps::Duration;
8
9#[derive(Debug, Clone)]
11pub struct ProgressConfig {
12 pub channel_capacity: usize,
14
15 pub eta_min_samples: usize,
17
18 pub eta_smoothing_factor: f64,
21
22 pub auto_finish_threshold: f64,
24
25 pub debounce_interval: Duration,
28}
29
30impl Default for ProgressConfig {
31 fn default() -> Self {
32 Self {
33 channel_capacity: 64,
34 eta_min_samples: 3,
35 eta_smoothing_factor: 0.3,
36 auto_finish_threshold: 1.0,
37 debounce_interval: Duration::from_millis(50),
38 }
39 }
40}
41
42impl ProgressConfig {
43 pub fn new() -> Self {
45 Self::default()
46 }
47
48 pub fn channel_capacity(mut self, capacity: usize) -> Self {
50 self.channel_capacity = capacity;
51 self
52 }
53
54 pub fn debounce_interval(mut self, interval: Duration) -> Self {
56 self.debounce_interval = interval;
57 self
58 }
59
60 pub fn no_debounce(mut self) -> Self {
62 self.debounce_interval = Duration::ZERO;
63 self
64 }
65}