Skip to main content

neco_expr/
id.rs

1macro_rules! id_type {
2    ($name:ident) => {
3        #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4        pub struct $name(u32);
5
6        impl $name {
7            pub const fn new(value: u32) -> Self {
8                Self(value)
9            }
10
11            pub const fn get(self) -> u32 {
12                self.0
13            }
14        }
15    };
16}
17
18id_type!(ExprId);
19id_type!(AtomId);
20id_type!(ConsumerId);
21id_type!(OwnerId);
22id_type!(AbsoluteBits);