use core::time::Duration;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BenchSampling {
samples: usize,
spend: Option<Duration>,
}
impl BenchSampling {
pub const fn new(samples: usize) -> Self {
Self { samples, spend: None }
}
#[must_use]
pub const fn spending(mut self, spend: Duration) -> Self {
self.spend = Some(spend);
self
}
pub const fn samples(self) -> usize {
self.samples
}
pub const fn spend(self) -> Option<Duration> {
self.spend
}
}
impl From<usize> for BenchSampling {
fn from(samples: usize) -> Self {
Self::new(samples)
}
}