#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct BlockId(pub(crate) usize);
impl BlockId {
pub const ENTRY: BlockId = BlockId(0);
#[must_use]
pub fn new(id: usize) -> Self {
BlockId(id)
}
#[must_use]
pub fn index(self) -> usize {
self.0
}
}
impl From<usize> for BlockId {
fn from(value: usize) -> Self {
BlockId(value)
}
}
impl std::fmt::Display for BlockId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "BB{}", self.0)
}
}