use serde::{Deserialize, Serialize};
macro_rules! define_index {
($name:ident) => {
#[derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize,
)]
#[serde(transparent)]
pub struct $name(u32);
impl $name {
#[must_use]
pub const fn new(index: u32) -> Self {
Self(index)
}
#[must_use]
pub const fn get(self) -> u32 {
self.0
}
#[must_use]
pub const fn index(self) -> usize {
self.0 as usize
}
}
};
}
define_index!(NodeIndex);
define_index!(EdgeIndex);