use crate::tui::app::VisibleRow;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct DetailCacheKey {
pub visible_row: VisibleRow,
pub generation: u64,
}
pub struct PaneDataStore {
detail_stamp: Option<DetailCacheKey>,
#[cfg(test)]
detail_builds: u64,
}
impl PaneDataStore {
pub const fn new() -> Self {
Self {
detail_stamp: None,
#[cfg(test)]
detail_builds: 0,
}
}
pub fn detail_is_current(&self, desired: Option<DetailCacheKey>) -> bool {
self.detail_stamp == desired
}
pub(super) const fn set_detail_stamp(&mut self, stamp: Option<DetailCacheKey>) {
self.detail_stamp = stamp;
#[cfg(test)]
{
self.detail_builds += 1;
}
}
#[cfg(test)]
pub const fn detail_build_count(&self) -> u64 { self.detail_builds }
}