use std::time::Duration;
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RuntimeState {
iter: usize,
time: Duration,
}
impl RuntimeState {
pub(crate) fn new() -> Self {
Self {
iter: 0,
time: Duration::new(0, 0),
}
}
pub fn iteration(&self) -> usize {
self.iter
}
pub fn increment_iteration(&mut self) {
self.iter += 1;
}
pub fn duration(&self) -> Duration {
self.time
}
pub fn record_duration(&mut self, duration: Duration) {
self.time = duration;
}
}