use core::fmt;
#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub(crate) struct ItemIndex(u32);
impl ItemIndex {
pub(crate) const MAX_VALID: Self = Self(u32::MAX - 1);
pub(crate) const SENTINEL: Self = Self(u32::MAX);
#[inline]
pub(crate) const fn new(value: u32) -> Self {
Self(value)
}
#[inline]
pub(crate) const fn as_u32(self) -> u32 {
self.0
}
}
impl fmt::Debug for ItemIndex {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl fmt::Display for ItemIndex {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}