use std::time::Duration;
use crate::Destination;
#[derive(Debug, Clone)]
pub struct Options {
pub(crate) update_interval: Duration,
pub(crate) print_holdoff: Duration,
pub(crate) progress_enabled: bool,
pub(crate) fake_clock: bool,
pub(crate) destination: Destination,
}
impl Options {
pub const fn new() -> Options {
Options {
update_interval: Duration::from_millis(100),
print_holdoff: Duration::from_millis(100),
progress_enabled: true,
fake_clock: false,
destination: Destination::Stdout,
}
}
pub const fn progress_enabled(self, progress_enabled: bool) -> Options {
Options {
progress_enabled,
..self
}
}
pub const fn update_interval(self, update_interval: Duration) -> Options {
Options {
update_interval,
..self
}
}
pub const fn print_holdoff(self, print_holdoff: Duration) -> Options {
Options {
print_holdoff,
..self
}
}
pub const fn fake_clock(self, fake_clock: bool) -> Options {
Options { fake_clock, ..self }
}
pub const fn destination(self, destination: Destination) -> Options {
Options {
destination,
..self
}
}
}
impl Default for Options {
fn default() -> Options {
Options::new()
}
}