Skip to main content

geop_core_topology/
ids.rs

1macro_rules! define_ids {
2    ($($name:ident),* $(,)?) => {
3        $(
4            #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
5            pub struct $name(pub u64);
6
7            impl std::fmt::Display for $name {
8                fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9                    write!(f, "{}({})", stringify!($name), self.0)
10                }
11            }
12
13            impl From<$name> for u64 {
14                fn from(id: $name) -> u64 {
15                    id.0
16                }
17            }
18        )*
19    };
20}
21
22define_ids!(VertexId, EdgeId, CoedgeId, FaceId, ShellId, SolidId,);