use crate::index::{Index, IndexInfo};
#[derive(Copy, Clone, Eq, PartialEq)]
pub enum IndexRefreshPolicy {
WhenRun,
WhenUsed,
EachFrame,
WhenInserted,
Manual,
}
impl IndexRefreshPolicy {
pub(crate) const fn is_when_run(&self) -> bool {
matches!(self, IndexRefreshPolicy::WhenRun)
}
pub(crate) const fn is_when_used(&self) -> bool {
matches!(self, IndexRefreshPolicy::WhenUsed)
}
pub(crate) const fn is_each_frame(&self) -> bool {
matches!(self, IndexRefreshPolicy::EachFrame)
}
pub(crate) const fn is_when_inserted(&self) -> bool {
matches!(self, IndexRefreshPolicy::WhenInserted)
}
#[expect(dead_code)]
pub(crate) const fn is_manual(&self) -> bool {
matches!(self, IndexRefreshPolicy::Manual)
}
}
pub fn refresh_index_system<I: IndexInfo>(mut idx: Index<I>) {
idx.refresh();
}