@@ -151,21 +151,7 @@ pub enum Arch {
151
151
152
152
impl fmt:: Display for Arch {
153
153
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
154
- match * self {
155
- Self :: Aarch64 => write ! ( f, "aarch64" ) ,
156
- Self :: Armv5TEL => write ! ( f, "armv5tel" ) ,
157
- Self :: Armv6L => write ! ( f, "armv6l" ) ,
158
- Self :: Armv7L => write ! ( f, "armv7l" ) ,
159
- Self :: Powerpc64Le => write ! ( f, "ppc64le" ) ,
160
- Self :: Powerpc64 => write ! ( f, "ppc64" ) ,
161
- Self :: Powerpc => write ! ( f, "ppc" ) ,
162
- Self :: X86 => write ! ( f, "i686" ) ,
163
- Self :: X86_64 => write ! ( f, "x86_64" ) ,
164
- Self :: S390X => write ! ( f, "s390x" ) ,
165
- Self :: LoongArch64 => write ! ( f, "loongarch64" ) ,
166
- Self :: Riscv64 => write ! ( f, "riscv64" ) ,
167
- Self :: Wasm32 => write ! ( f, "wasm32" ) ,
168
- }
154
+ write ! ( f, "{}" , self . name( ) )
169
155
}
170
156
}
171
157
@@ -211,7 +197,7 @@ impl Arch {
211
197
}
212
198
}
213
199
214
- /// Returns the canonical name of the architecture.
200
+ /// Returns the standard name of the architecture in the Linux world .
215
201
pub fn name ( & self ) -> & ' static str {
216
202
match self {
217
203
Self :: Aarch64 => "aarch64" ,
@@ -230,23 +216,61 @@ impl Arch {
230
216
}
231
217
}
232
218
233
- /// Returns an iterator over all supported architectures.
234
- pub fn iter ( ) -> impl Iterator < Item = Self > {
235
- [
236
- Self :: Aarch64 ,
237
- Self :: Armv5TEL ,
238
- Self :: Armv6L ,
239
- Self :: Armv7L ,
240
- Self :: Powerpc64Le ,
241
- Self :: Powerpc64 ,
242
- Self :: Powerpc ,
243
- Self :: X86 ,
244
- Self :: X86_64 ,
245
- Self :: S390X ,
246
- Self :: LoongArch64 ,
247
- Self :: Riscv64 ,
248
- ]
249
- . iter ( )
250
- . copied ( )
219
+ /// Returns the standard name of the architecture in the FreeBSD world.
220
+ pub fn freebsd_name ( & self ) -> Option < & ' static str > {
221
+ match self {
222
+ Self :: Aarch64 => None ,
223
+ Self :: Armv5TEL => Some ( "armv5" ) ,
224
+ Self :: Armv6L => Some ( "armv6" ) ,
225
+ Self :: Armv7L => Some ( "armv7" ) ,
226
+ Self :: Powerpc64Le => Some ( "powerpc64le" ) ,
227
+ Self :: Powerpc64 => Some ( "powerpc64" ) ,
228
+ Self :: Powerpc => Some ( "powerpc" ) ,
229
+ Self :: X86 => Some ( "i386" ) ,
230
+ Self :: X86_64 => Some ( "amd64" ) ,
231
+ Self :: S390X => None ,
232
+ Self :: LoongArch64 => None ,
233
+ Self :: Riscv64 => None ,
234
+ Self :: Wasm32 => None ,
235
+ }
236
+ }
237
+
238
+ /// Returns the standard name of the architecture in the NetBSD world.
239
+ pub fn netbsd_name ( & self ) -> Option < & ' static str > {
240
+ match self {
241
+ Self :: Aarch64 => None ,
242
+ Self :: Armv5TEL => Some ( "armv5" ) ,
243
+ Self :: Armv6L => Some ( "armv6" ) ,
244
+ Self :: Armv7L => Some ( "armv7" ) ,
245
+ Self :: Powerpc64Le => Some ( "powerpc64le" ) ,
246
+ Self :: Powerpc64 => Some ( "powerpc64" ) ,
247
+ Self :: Powerpc => Some ( "powerpc" ) ,
248
+ Self :: X86 => Some ( "i386" ) ,
249
+ Self :: X86_64 => Some ( "amd64" ) ,
250
+ Self :: S390X => None ,
251
+ Self :: LoongArch64 => None ,
252
+ Self :: Riscv64 => None ,
253
+ Self :: Wasm32 => None ,
254
+ }
255
+ }
256
+
257
+
258
+ /// Returns the standard name of the architecture in the FreeBSD world.
259
+ pub fn openbsd_name ( & self ) -> Option < & ' static str > {
260
+ match self {
261
+ Self :: Aarch64 => Some ( "arm64" ) ,
262
+ Self :: Armv5TEL => Some ( "armv5" ) ,
263
+ Self :: Armv6L => Some ( "armv6" ) ,
264
+ Self :: Armv7L => Some ( "armv7" ) ,
265
+ Self :: Powerpc64Le => Some ( "powerpc64le" ) ,
266
+ Self :: Powerpc64 => Some ( "powerpc64" ) ,
267
+ Self :: Powerpc => Some ( "powerpc" ) ,
268
+ Self :: X86 => Some ( "i386" ) ,
269
+ Self :: X86_64 => Some ( "amd64" ) ,
270
+ Self :: S390X => None ,
271
+ Self :: LoongArch64 => None ,
272
+ Self :: Riscv64 => None ,
273
+ Self :: Wasm32 => None ,
274
+ }
251
275
}
252
276
}
0 commit comments