use crate::util::index_pool::PoolIndex;
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd, bytemuck::Pod, bytemuck::Zeroable)]
pub(crate) struct VertexIndex(pub(crate) u32);
impl PoolIndex for VertexIndex {}
impl VertexIndex {
pub const INVALID: VertexIndex = VertexIndex(u32::MAX);
#[inline(always)]
pub(crate) fn canonical_pair(a: Self, b: Self) -> (Self, Self) {
if a.0 < b.0 { (a, b) } else { (b, a) }
}
#[inline(always)]
pub(crate) const fn usize(self) -> usize {
self.0 as usize
}
#[inline(always)]
pub fn is_valid(self) -> bool {
self.0 != Self::INVALID.0
}
}