1use geop_core_topology::{EdgeId, FaceId, SolidId, VertexId};
2
3#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
6pub enum RefId {
7 Vertex(VertexId),
8 Edge(EdgeId),
9 Face(FaceId),
10 Solid(SolidId),
11}
12
13impl std::fmt::Display for RefId {
14 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15 match self {
16 RefId::Vertex(id) => write!(f, "{id}"),
17 RefId::Edge(id) => write!(f, "{id}"),
18 RefId::Face(id) => write!(f, "{id}"),
19 RefId::Solid(id) => write!(f, "{id}"),
20 }
21 }
22}
23
24impl From<VertexId> for RefId {
25 fn from(id: VertexId) -> Self {
26 RefId::Vertex(id)
27 }
28}
29
30impl From<EdgeId> for RefId {
31 fn from(id: EdgeId) -> Self {
32 RefId::Edge(id)
33 }
34}
35
36impl From<FaceId> for RefId {
37 fn from(id: FaceId) -> Self {
38 RefId::Face(id)
39 }
40}
41
42impl From<SolidId> for RefId {
43 fn from(id: SolidId) -> Self {
44 RefId::Solid(id)
45 }
46}