use super::IndexState;
#[derive(Clone, Copy, Debug)]
#[must_use = "the entry view provides access to a stored record"]
pub struct EntryRef<'a, K, O, V> {
pub(crate) key: &'a K,
pub(crate) order: &'a O,
pub(crate) value: &'a V,
pub(crate) state: IndexState,
}
impl<'a, K, O, V> EntryRef<'a, K, O, V> {
#[must_use]
#[inline]
pub const fn key(&self) -> &'a K {
self.key
}
#[must_use]
#[inline]
pub const fn order(&self) -> &'a O {
self.order
}
#[must_use]
#[inline]
pub const fn value(&self) -> &'a V {
self.value
}
#[must_use = "the attachment state describes ordered visibility"]
#[inline]
pub const fn state(&self) -> IndexState {
self.state
}
#[must_use]
#[inline]
pub const fn is_attached(&self) -> bool {
matches!(self.state, IndexState::Attached)
}
#[must_use]
#[inline]
pub const fn is_detached(&self) -> bool {
matches!(self.state, IndexState::Detached)
}
}