1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub enum FeatureId {
Vertex(u32),
#[cfg(feature = "dim3")]
Edge(u32),
Face(u32),
Unknown,
}
impl FeatureId {
pub fn unwrap_vertex(self) -> u32 {
match self {
FeatureId::Vertex(id) => id,
_ => panic!("The feature id does not identify a vertex."),
}
}
#[cfg(feature = "dim3")]
pub fn unwrap_edge(self) -> u32 {
match self {
FeatureId::Edge(id) => id,
_ => panic!("The feature id does not identify an edge."),
}
}
pub fn unwrap_face(self) -> u32 {
match self {
FeatureId::Face(id) => id,
_ => panic!("The feature id does not identify a face."),
}
}
}