Skip to main content

shacl_ir/compiled/
shape_label_idx.rs

1use std::fmt::Display;
2
3#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug, Default)]
4pub struct ShapeLabelIdx(usize);
5
6impl ShapeLabelIdx {
7    pub fn new(idx: usize) -> Self {
8        ShapeLabelIdx(idx)
9    }
10}
11
12impl Display for ShapeLabelIdx {
13    fn fmt(&self, dest: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
14        write!(dest, "{}", self.0)
15    }
16}
17
18impl From<usize> for ShapeLabelIdx {
19    fn from(idx: usize) -> Self {
20        ShapeLabelIdx(idx)
21    }
22}