use crate::deps::Duration;
#[derive(Debug, Clone)]
pub struct ProgressConfig {
pub channel_capacity: usize,
pub eta_min_samples: usize,
pub eta_smoothing_factor: f64,
pub auto_finish_threshold: f64,
pub debounce_interval: Duration,
}
impl Default for ProgressConfig {
fn default() -> Self {
Self {
channel_capacity: 64,
eta_min_samples: 3,
eta_smoothing_factor: 0.3,
auto_finish_threshold: 1.0,
debounce_interval: Duration::from_millis(50),
}
}
}
impl ProgressConfig {
pub fn new() -> Self {
Self::default()
}
pub fn channel_capacity(mut self, capacity: usize) -> Self {
self.channel_capacity = capacity;
self
}
pub fn debounce_interval(mut self, interval: Duration) -> Self {
self.debounce_interval = interval;
self
}
pub fn no_debounce(mut self) -> Self {
self.debounce_interval = Duration::ZERO;
self
}
}