#[derive(Copy, Clone, Debug)]
pub struct DurationOptions {
pub(crate) max_units: u8,
pub(crate) long_units: bool,
}
impl DurationOptions {
#[inline]
pub const fn new() -> Self {
Self {
max_units: 2,
long_units: false,
}
}
#[inline]
pub const fn max_units(mut self, n: u8) -> Self {
let n = if n < 1 {
1
} else if n > 7 {
7
} else {
n
};
self.max_units = n;
self
}
#[inline]
pub const fn long_units(mut self) -> Self {
self.long_units = true;
self
}
}
impl Default for DurationOptions {
#[inline]
fn default() -> Self {
Self::new()
}
}