1#![forbid(unsafe_code)]
2#![doc = include_str!("../README.md")]
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub enum ArchimedeanSolid {
7 TruncatedTetrahedron,
9 Cuboctahedron,
11 TruncatedCube,
13 TruncatedOctahedron,
15 Rhombicuboctahedron,
17 TruncatedCuboctahedron,
19 SnubCube,
21 Icosidodecahedron,
23 TruncatedDodecahedron,
25 TruncatedIcosahedron,
27 Rhombicosidodecahedron,
29 TruncatedIcosidodecahedron,
31 SnubDodecahedron,
33}
34
35impl ArchimedeanSolid {
36 #[must_use]
38 pub const fn name(self) -> &'static str {
39 match self {
40 Self::TruncatedTetrahedron => "truncated tetrahedron",
41 Self::Cuboctahedron => "cuboctahedron",
42 Self::TruncatedCube => "truncated cube",
43 Self::TruncatedOctahedron => "truncated octahedron",
44 Self::Rhombicuboctahedron => "rhombicuboctahedron",
45 Self::TruncatedCuboctahedron => "truncated cuboctahedron",
46 Self::SnubCube => "snub cube",
47 Self::Icosidodecahedron => "icosidodecahedron",
48 Self::TruncatedDodecahedron => "truncated dodecahedron",
49 Self::TruncatedIcosahedron => "truncated icosahedron",
50 Self::Rhombicosidodecahedron => "rhombicosidodecahedron",
51 Self::TruncatedIcosidodecahedron => "truncated icosidodecahedron",
52 Self::SnubDodecahedron => "snub dodecahedron",
53 }
54 }
55
56 #[must_use]
58 pub const fn face_configuration(self) -> &'static str {
59 match self {
60 Self::TruncatedTetrahedron => "3.6.6",
61 Self::Cuboctahedron => "3.4.3.4",
62 Self::TruncatedCube => "3.8.8",
63 Self::TruncatedOctahedron => "4.6.6",
64 Self::Rhombicuboctahedron => "3.4.4.4",
65 Self::TruncatedCuboctahedron => "4.6.8",
66 Self::SnubCube => "3.3.3.3.4",
67 Self::Icosidodecahedron => "3.5.3.5",
68 Self::TruncatedDodecahedron => "3.10.10",
69 Self::TruncatedIcosahedron => "5.6.6",
70 Self::Rhombicosidodecahedron => "3.4.5.4",
71 Self::TruncatedIcosidodecahedron => "4.6.10",
72 Self::SnubDodecahedron => "3.3.3.3.5",
73 }
74 }
75}
76
77#[cfg(test)]
78mod tests {
79 use super::ArchimedeanSolid;
80
81 #[test]
82 fn exposes_cuboctahedron_metadata() {
83 let solid = ArchimedeanSolid::Cuboctahedron;
84
85 assert_eq!(solid.name(), "cuboctahedron");
86 assert_eq!(solid.face_configuration(), "3.4.3.4");
87 assert_eq!(
88 ArchimedeanSolid::TruncatedIcosahedron.face_configuration(),
89 "5.6.6"
90 );
91 }
92}