Skip to main content

target_spec_json/gen/
target_spec.rs

1// SPDX-License-Identifier: Apache-2.0 OR MIT
2// This file is @generated by target_spec.sh.
3// It is not intended for manual editing.
4
5#![allow(non_camel_case_types)]
6
7use serde_derive::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
10#[non_exhaustive]
11pub enum Arch {
12    aarch64,
13    amdgpu,
14    arm,
15    arm64ec,
16    avr,
17    bpf,
18    csky,
19    hexagon,
20    loongarch32,
21    loongarch64,
22    m68k,
23    mips,
24    mips32r6,
25    mips64,
26    mips64r6,
27    msp430,
28    nvptx64,
29    powerpc,
30    powerpc64,
31    riscv32,
32    riscv64,
33    s390x,
34    sparc,
35    sparc64,
36    spirv,
37    wasm32,
38    wasm64,
39    x86,
40    x86_64,
41    xtensa,
42}
43impl Arch {
44    #[must_use]
45    pub fn as_str(self) -> &'static str {
46        match self {
47            Self::aarch64 => "aarch64",
48            Self::amdgpu => "amdgpu",
49            Self::arm => "arm",
50            Self::arm64ec => "arm64ec",
51            Self::avr => "avr",
52            Self::bpf => "bpf",
53            Self::csky => "csky",
54            Self::hexagon => "hexagon",
55            Self::loongarch32 => "loongarch32",
56            Self::loongarch64 => "loongarch64",
57            Self::m68k => "m68k",
58            Self::mips => "mips",
59            Self::mips32r6 => "mips32r6",
60            Self::mips64 => "mips64",
61            Self::mips64r6 => "mips64r6",
62            Self::msp430 => "msp430",
63            Self::nvptx64 => "nvptx64",
64            Self::powerpc => "powerpc",
65            Self::powerpc64 => "powerpc64",
66            Self::riscv32 => "riscv32",
67            Self::riscv64 => "riscv64",
68            Self::s390x => "s390x",
69            Self::sparc => "sparc",
70            Self::sparc64 => "sparc64",
71            Self::spirv => "spirv",
72            Self::wasm32 => "wasm32",
73            Self::wasm64 => "wasm64",
74            Self::x86 => "x86",
75            Self::x86_64 => "x86_64",
76            Self::xtensa => "xtensa",
77        }
78    }
79}
80impl core::fmt::Display for Arch {
81    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
82        f.write_str(self.as_str())
83    }
84}
85
86#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
87#[non_exhaustive]
88pub enum Os {
89    aix,
90    amdhsa,
91    android,
92    cuda,
93    cygwin,
94    dragonfly,
95    emscripten,
96    espidf,
97    freebsd,
98    fuchsia,
99    haiku,
100    helenos,
101    hermit,
102    horizon,
103    hurd,
104    illumos,
105    ios,
106    l4re,
107    linux,
108    lynxos178,
109    macos,
110    managarm,
111    motor,
112    netbsd,
113    #[default]
114    none,
115    nto,
116    nuttx,
117    openbsd,
118    psp,
119    psx,
120    qnx,
121    qurt,
122    redox,
123    rtems,
124    solaris,
125    solid_asp3,
126    teeos,
127    trusty,
128    tvos,
129    uefi,
130    unknown,
131    vexos,
132    visionos,
133    vita,
134    vxworks,
135    wasi,
136    watchos,
137    windows,
138    xous,
139    zephyr,
140    zkvm,
141}
142impl Os {
143    #[must_use]
144    pub fn as_str(self) -> &'static str {
145        match self {
146            Self::aix => "aix",
147            Self::amdhsa => "amdhsa",
148            Self::android => "android",
149            Self::cuda => "cuda",
150            Self::cygwin => "cygwin",
151            Self::dragonfly => "dragonfly",
152            Self::emscripten => "emscripten",
153            Self::espidf => "espidf",
154            Self::freebsd => "freebsd",
155            Self::fuchsia => "fuchsia",
156            Self::haiku => "haiku",
157            Self::helenos => "helenos",
158            Self::hermit => "hermit",
159            Self::horizon => "horizon",
160            Self::hurd => "hurd",
161            Self::illumos => "illumos",
162            Self::ios => "ios",
163            Self::l4re => "l4re",
164            Self::linux => "linux",
165            Self::lynxos178 => "lynxos178",
166            Self::macos => "macos",
167            Self::managarm => "managarm",
168            Self::motor => "motor",
169            Self::netbsd => "netbsd",
170            Self::none => "none",
171            Self::nto => "nto",
172            Self::nuttx => "nuttx",
173            Self::openbsd => "openbsd",
174            Self::psp => "psp",
175            Self::psx => "psx",
176            Self::qnx => "qnx",
177            Self::qurt => "qurt",
178            Self::redox => "redox",
179            Self::rtems => "rtems",
180            Self::solaris => "solaris",
181            Self::solid_asp3 => "solid_asp3",
182            Self::teeos => "teeos",
183            Self::trusty => "trusty",
184            Self::tvos => "tvos",
185            Self::uefi => "uefi",
186            Self::unknown => "unknown",
187            Self::vexos => "vexos",
188            Self::visionos => "visionos",
189            Self::vita => "vita",
190            Self::vxworks => "vxworks",
191            Self::wasi => "wasi",
192            Self::watchos => "watchos",
193            Self::windows => "windows",
194            Self::xous => "xous",
195            Self::zephyr => "zephyr",
196            Self::zkvm => "zkvm",
197        }
198    }
199}
200impl Os {
201    #[allow(clippy::trivially_copy_pass_by_ref)]
202    pub(crate) fn is_none(&self) -> bool {
203        matches!(self, Self::none)
204    }
205}
206impl core::fmt::Display for Os {
207    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
208        f.write_str(self.as_str())
209    }
210}
211
212#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
213#[non_exhaustive]
214pub enum Env {
215    gnu,
216    libnx,
217    macabi,
218    mlibc,
219    msvc,
220    musl,
221    newlib,
222    #[default]
223    none,
224    nto70,
225    nto71,
226    nto71_iosock,
227    nto80,
228    ohos,
229    p1,
230    p2,
231    p3,
232    relibc,
233    sgx,
234    sim,
235    uclibc,
236    v5,
237}
238impl Env {
239    #[must_use]
240    pub fn as_str(self) -> &'static str {
241        match self {
242            Self::gnu => "gnu",
243            Self::libnx => "libnx",
244            Self::macabi => "macabi",
245            Self::mlibc => "mlibc",
246            Self::msvc => "msvc",
247            Self::musl => "musl",
248            Self::newlib => "newlib",
249            Self::none => "",
250            Self::nto70 => "nto70",
251            Self::nto71 => "nto71",
252            Self::nto71_iosock => "nto71_iosock",
253            Self::nto80 => "nto80",
254            Self::ohos => "ohos",
255            Self::p1 => "p1",
256            Self::p2 => "p2",
257            Self::p3 => "p3",
258            Self::relibc => "relibc",
259            Self::sgx => "sgx",
260            Self::sim => "sim",
261            Self::uclibc => "uclibc",
262            Self::v5 => "v5",
263        }
264    }
265}
266impl Env {
267    #[allow(clippy::trivially_copy_pass_by_ref)]
268    pub(crate) fn is_none(&self) -> bool {
269        matches!(self, Self::none)
270    }
271}
272impl core::fmt::Display for Env {
273    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
274        f.write_str(self.as_str())
275    }
276}
277
278#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
279#[non_exhaustive]
280pub enum TargetFamily {
281    unix,
282    wasm,
283    windows,
284}
285impl TargetFamily {
286    #[must_use]
287    pub fn as_str(self) -> &'static str {
288        match self {
289            Self::unix => "unix",
290            Self::wasm => "wasm",
291            Self::windows => "windows",
292        }
293    }
294}
295impl core::fmt::Display for TargetFamily {
296    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
297        f.write_str(self.as_str())
298    }
299}
300
301#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
302#[non_exhaustive]
303pub enum Sanitizer {
304    address,
305    cfi,
306    dataflow,
307    hwaddress,
308    kcfi,
309    #[serde(rename = "kernel-address")]
310    kernel_address,
311    #[serde(rename = "kernel-hwaddress")]
312    kernel_hwaddress,
313    leak,
314    memory,
315    memtag,
316    realtime,
317    safestack,
318    #[serde(rename = "shadow-call-stack")]
319    shadow_call_stack,
320    thread,
321}
322impl Sanitizer {
323    #[must_use]
324    pub fn as_str(self) -> &'static str {
325        match self {
326            Self::address => "address",
327            Self::cfi => "cfi",
328            Self::dataflow => "dataflow",
329            Self::hwaddress => "hwaddress",
330            Self::kcfi => "kcfi",
331            Self::kernel_address => "kernel-address",
332            Self::kernel_hwaddress => "kernel-hwaddress",
333            Self::leak => "leak",
334            Self::memory => "memory",
335            Self::memtag => "memtag",
336            Self::realtime => "realtime",
337            Self::safestack => "safestack",
338            Self::shadow_call_stack => "shadow-call-stack",
339            Self::thread => "thread",
340        }
341    }
342}
343impl core::fmt::Display for Sanitizer {
344    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
345        f.write_str(self.as_str())
346    }
347}
348
349#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
350#[non_exhaustive]
351pub enum BinaryFormat {
352    coff,
353    #[default]
354    elf,
355    #[serde(rename = "mach-o")]
356    mach_o,
357    wasm,
358    xcoff,
359}
360impl BinaryFormat {
361    #[must_use]
362    pub fn as_str(self) -> &'static str {
363        match self {
364            Self::coff => "coff",
365            Self::elf => "elf",
366            Self::mach_o => "mach-o",
367            Self::wasm => "wasm",
368            Self::xcoff => "xcoff",
369        }
370    }
371}
372impl BinaryFormat {
373    #[allow(clippy::trivially_copy_pass_by_ref)]
374    pub(crate) fn is_elf(&self) -> bool {
375        matches!(self, Self::elf)
376    }
377}
378impl core::fmt::Display for BinaryFormat {
379    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
380        f.write_str(self.as_str())
381    }
382}
383
384#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
385#[allow(clippy::exhaustive_enums)]
386pub enum TargetEndian {
387    big,
388    #[default]
389    little,
390}
391impl TargetEndian {
392    #[must_use]
393    pub fn as_str(self) -> &'static str {
394        match self {
395            Self::big => "big",
396            Self::little => "little",
397        }
398    }
399}
400impl TargetEndian {
401    #[allow(clippy::trivially_copy_pass_by_ref)]
402    pub(crate) fn is_little(&self) -> bool {
403        matches!(self, Self::little)
404    }
405}
406impl core::fmt::Display for TargetEndian {
407    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
408        f.write_str(self.as_str())
409    }
410}
411
412#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
413#[allow(clippy::exhaustive_enums)]
414pub enum PanicStrategy {
415    abort,
416    #[default]
417    unwind,
418}
419impl PanicStrategy {
420    #[must_use]
421    pub fn as_str(self) -> &'static str {
422        match self {
423            Self::abort => "abort",
424            Self::unwind => "unwind",
425        }
426    }
427}
428impl PanicStrategy {
429    #[allow(clippy::trivially_copy_pass_by_ref)]
430    pub(crate) fn is_unwind(&self) -> bool {
431        matches!(self, Self::unwind)
432    }
433}
434impl core::fmt::Display for PanicStrategy {
435    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
436        f.write_str(self.as_str())
437    }
438}