honeycomb_core/cmap/components/
identifiers.rs

1// --- type aliases
2
3/// Dart ID representation type
4pub type DartIdType = u32;
5
6/// Vertex ID representation type
7pub type VertexIdType = u32;
8
9/// Edge ID representation type
10pub type EdgeIdType = u32;
11
12/// Face ID representation type
13pub type FaceIdType = u32;
14
15/// Volume ID representation type
16pub type VolumeIdType = u32;
17
18// --- null values
19
20/// Null dart ID value
21pub const NULL_DART_ID: DartIdType = 0; //: DartId = DartId(0);
22
23/// Null vertex ID value
24pub const NULL_VERTEX_ID: VertexIdType = 0; //: VertexId = VertexId(0);
25
26/// Null edge ID value
27pub const NULL_EDGE_ID: EdgeIdType = 0; //: EdgeId = EdgeId(0);
28
29/// Null face ID value
30pub const NULL_FACE_ID: FaceIdType = 0; //: FaceId = FaceId(0);
31
32/// Null volume ID value
33pub const NULL_VOLUME_ID: VolumeIdType = 0; //: VolumeId = VolumeId(0);
34
35// --- strongly typed variants (unused)
36
37/*
38macro_rules! impl_from_dartid {
39    ($idty: ty) => {
40        impl From<DartId> for $idty {
41            fn from(dart_id: DartId) -> Self {
42                Self(dart_id.0.into())
43            }
44        }
45    };
46}
47
48macro_rules! impl_from_for_dartid {
49    ($idty: ty) => {
50        impl From<$idty> for DartId {
51            fn from(id: $idty) -> Self {
52                Self(id.0.into())
53            }
54        }
55    };
56}
57
58/// Strongly-typed dart ID.
59#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
60pub struct DartId(pub DartIdType);
61
62impl_from_for_dartid!(VertexId);
63impl_from_for_dartid!(EdgeId);
64impl_from_for_dartid!(FaceId);
65impl_from_for_dartid!(VolumeId);
66
67/// Strongly-typed vertex ID.
68#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
69pub struct VertexId(pub VertexIdType);
70
71impl_from_dartid!(VertexId);
72
73/// Strongly-typed edge ID.
74#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
75pub struct EdgeId(pub EdgeIdType);
76
77impl_from_dartid!(EdgeId);
78
79/// Strongly-typed face ID.
80#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
81pub struct FaceId(pub FaceIdType);
82
83impl_from_dartid!(FaceId);
84
85/// Strongly-typed volume ID.
86#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
87pub struct VolumeId(pub VolumeIdType);
88
89impl_from_dartid!(VolumeId);
90 */