1use std::fmt;
4
5#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
9pub struct GroupId(
10 pub String,
12);
13
14impl GroupId {
15 pub fn as_str(&self) -> &str {
17 &self.0
18 }
19}
20
21impl From<String> for GroupId {
22 fn from(value: String) -> Self {
23 Self(value)
24 }
25}
26
27impl From<&str> for GroupId {
28 fn from(value: &str) -> Self {
29 Self(value.to_string())
30 }
31}
32
33impl fmt::Display for GroupId {
34 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35 f.write_str(&self.0)
36 }
37}
38
39#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
45pub struct EntityId {
46 pub group: GroupId,
48 pub category: String,
50 pub name: String,
52}
53
54impl EntityId {
55 pub fn new(
57 group: impl Into<GroupId>,
58 category: impl Into<String>,
59 name: impl Into<String>,
60 ) -> Self {
61 Self {
62 group: group.into(),
63 category: category.into(),
64 name: name.into(),
65 }
66 }
67}
68
69#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
74pub struct ModuleId(
75 pub String,
77);
78
79impl ModuleId {
80 pub fn as_str(&self) -> &str {
82 &self.0
83 }
84}
85
86impl From<String> for ModuleId {
87 fn from(value: String) -> Self {
88 Self(value)
89 }
90}
91
92impl From<&str> for ModuleId {
93 fn from(value: &str) -> Self {
94 Self(value.to_string())
95 }
96}
97
98impl fmt::Display for ModuleId {
99 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
100 f.write_str(&self.0)
101 }
102}
103
104#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
109pub struct SpecVersion(
110 pub String,
112);
113
114impl SpecVersion {
115 pub fn as_str(&self) -> &str {
117 &self.0
118 }
119}
120
121impl From<String> for SpecVersion {
122 fn from(value: String) -> Self {
123 Self(value)
124 }
125}
126
127impl From<&str> for SpecVersion {
128 fn from(value: &str) -> Self {
129 Self(value.to_string())
130 }
131}
132
133impl fmt::Display for SpecVersion {
134 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
135 f.write_str(&self.0)
136 }
137}