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    hyperlight,
105    illumos,
106    ios,
107    l4re,
108    linux,
109    lynxos178,
110    macos,
111    managarm,
112    motor,
113    netbsd,
114    #[default]
115    none,
116    nto,
117    nuttx,
118    openbsd,
119    ps3,
120    psp,
121    psx,
122    qnx,
123    qurt,
124    redox,
125    rtems,
126    solaris,
127    solid_asp3,
128    teeos,
129    trusty,
130    tvos,
131    uefi,
132    unknown,
133    vexos,
134    visionos,
135    vita,
136    vxworks,
137    wasi,
138    watchos,
139    windows,
140    xous,
141    zephyr,
142    zkvm,
143}
144impl Os {
145    #[must_use]
146    pub fn as_str(self) -> &'static str {
147        match self {
148            Self::aix => "aix",
149            Self::amdhsa => "amdhsa",
150            Self::android => "android",
151            Self::cuda => "cuda",
152            Self::cygwin => "cygwin",
153            Self::dragonfly => "dragonfly",
154            Self::emscripten => "emscripten",
155            Self::espidf => "espidf",
156            Self::freebsd => "freebsd",
157            Self::fuchsia => "fuchsia",
158            Self::haiku => "haiku",
159            Self::helenos => "helenos",
160            Self::hermit => "hermit",
161            Self::horizon => "horizon",
162            Self::hurd => "hurd",
163            Self::hyperlight => "hyperlight",
164            Self::illumos => "illumos",
165            Self::ios => "ios",
166            Self::l4re => "l4re",
167            Self::linux => "linux",
168            Self::lynxos178 => "lynxos178",
169            Self::macos => "macos",
170            Self::managarm => "managarm",
171            Self::motor => "motor",
172            Self::netbsd => "netbsd",
173            Self::none => "none",
174            Self::nto => "nto",
175            Self::nuttx => "nuttx",
176            Self::openbsd => "openbsd",
177            Self::ps3 => "ps3",
178            Self::psp => "psp",
179            Self::psx => "psx",
180            Self::qnx => "qnx",
181            Self::qurt => "qurt",
182            Self::redox => "redox",
183            Self::rtems => "rtems",
184            Self::solaris => "solaris",
185            Self::solid_asp3 => "solid_asp3",
186            Self::teeos => "teeos",
187            Self::trusty => "trusty",
188            Self::tvos => "tvos",
189            Self::uefi => "uefi",
190            Self::unknown => "unknown",
191            Self::vexos => "vexos",
192            Self::visionos => "visionos",
193            Self::vita => "vita",
194            Self::vxworks => "vxworks",
195            Self::wasi => "wasi",
196            Self::watchos => "watchos",
197            Self::windows => "windows",
198            Self::xous => "xous",
199            Self::zephyr => "zephyr",
200            Self::zkvm => "zkvm",
201        }
202    }
203}
204impl Os {
205    #[allow(clippy::trivially_copy_pass_by_ref)]
206    pub(crate) fn is_none(&self) -> bool {
207        matches!(self, Self::none)
208    }
209}
210impl core::fmt::Display for Os {
211    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
212        f.write_str(self.as_str())
213    }
214}
215
216#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
217#[non_exhaustive]
218pub enum Env {
219    gnu,
220    libnx,
221    macabi,
222    mlibc,
223    msvc,
224    musl,
225    newlib,
226    #[default]
227    none,
228    nto70,
229    nto71,
230    nto71_iosock,
231    nto80,
232    ohos,
233    p1,
234    p2,
235    p3,
236    relibc,
237    sgx,
238    sim,
239    uclibc,
240    v5,
241}
242impl Env {
243    #[must_use]
244    pub fn as_str(self) -> &'static str {
245        match self {
246            Self::gnu => "gnu",
247            Self::libnx => "libnx",
248            Self::macabi => "macabi",
249            Self::mlibc => "mlibc",
250            Self::msvc => "msvc",
251            Self::musl => "musl",
252            Self::newlib => "newlib",
253            Self::none => "",
254            Self::nto70 => "nto70",
255            Self::nto71 => "nto71",
256            Self::nto71_iosock => "nto71_iosock",
257            Self::nto80 => "nto80",
258            Self::ohos => "ohos",
259            Self::p1 => "p1",
260            Self::p2 => "p2",
261            Self::p3 => "p3",
262            Self::relibc => "relibc",
263            Self::sgx => "sgx",
264            Self::sim => "sim",
265            Self::uclibc => "uclibc",
266            Self::v5 => "v5",
267        }
268    }
269}
270impl Env {
271    #[allow(clippy::trivially_copy_pass_by_ref)]
272    pub(crate) fn is_none(&self) -> bool {
273        matches!(self, Self::none)
274    }
275}
276impl core::fmt::Display for Env {
277    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
278        f.write_str(self.as_str())
279    }
280}
281
282#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
283#[non_exhaustive]
284pub enum TargetFamily {
285    unix,
286    wasm,
287    windows,
288}
289impl TargetFamily {
290    #[must_use]
291    pub fn as_str(self) -> &'static str {
292        match self {
293            Self::unix => "unix",
294            Self::wasm => "wasm",
295            Self::windows => "windows",
296        }
297    }
298}
299impl core::fmt::Display for TargetFamily {
300    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
301        f.write_str(self.as_str())
302    }
303}
304
305#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
306#[non_exhaustive]
307pub enum Sanitizer {
308    address,
309    cfi,
310    dataflow,
311    hwaddress,
312    kcfi,
313    #[serde(rename = "kernel-address")]
314    kernel_address,
315    #[serde(rename = "kernel-hwaddress")]
316    kernel_hwaddress,
317    leak,
318    memory,
319    memtag,
320    realtime,
321    safestack,
322    #[serde(rename = "shadow-call-stack")]
323    shadow_call_stack,
324    thread,
325}
326impl Sanitizer {
327    #[must_use]
328    pub fn as_str(self) -> &'static str {
329        match self {
330            Self::address => "address",
331            Self::cfi => "cfi",
332            Self::dataflow => "dataflow",
333            Self::hwaddress => "hwaddress",
334            Self::kcfi => "kcfi",
335            Self::kernel_address => "kernel-address",
336            Self::kernel_hwaddress => "kernel-hwaddress",
337            Self::leak => "leak",
338            Self::memory => "memory",
339            Self::memtag => "memtag",
340            Self::realtime => "realtime",
341            Self::safestack => "safestack",
342            Self::shadow_call_stack => "shadow-call-stack",
343            Self::thread => "thread",
344        }
345    }
346}
347impl core::fmt::Display for Sanitizer {
348    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
349        f.write_str(self.as_str())
350    }
351}
352
353#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
354#[non_exhaustive]
355pub enum BinaryFormat {
356    coff,
357    #[default]
358    elf,
359    #[serde(rename = "mach-o")]
360    mach_o,
361    wasm,
362    xcoff,
363}
364impl BinaryFormat {
365    #[must_use]
366    pub fn as_str(self) -> &'static str {
367        match self {
368            Self::coff => "coff",
369            Self::elf => "elf",
370            Self::mach_o => "mach-o",
371            Self::wasm => "wasm",
372            Self::xcoff => "xcoff",
373        }
374    }
375}
376impl BinaryFormat {
377    #[allow(clippy::trivially_copy_pass_by_ref)]
378    pub(crate) fn is_elf(&self) -> bool {
379        matches!(self, Self::elf)
380    }
381}
382impl core::fmt::Display for BinaryFormat {
383    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
384        f.write_str(self.as_str())
385    }
386}
387
388#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
389#[allow(clippy::exhaustive_enums)]
390pub enum TargetEndian {
391    big,
392    #[default]
393    little,
394}
395impl TargetEndian {
396    #[must_use]
397    pub fn as_str(self) -> &'static str {
398        match self {
399            Self::big => "big",
400            Self::little => "little",
401        }
402    }
403}
404impl TargetEndian {
405    #[allow(clippy::trivially_copy_pass_by_ref)]
406    pub(crate) fn is_little(&self) -> bool {
407        matches!(self, Self::little)
408    }
409}
410impl core::fmt::Display for TargetEndian {
411    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
412        f.write_str(self.as_str())
413    }
414}
415
416#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
417#[allow(clippy::exhaustive_enums)]
418pub enum PanicStrategy {
419    abort,
420    #[default]
421    unwind,
422}
423impl PanicStrategy {
424    #[must_use]
425    pub fn as_str(self) -> &'static str {
426        match self {
427            Self::abort => "abort",
428            Self::unwind => "unwind",
429        }
430    }
431}
432impl PanicStrategy {
433    #[allow(clippy::trivially_copy_pass_by_ref)]
434    pub(crate) fn is_unwind(&self) -> bool {
435        matches!(self, Self::unwind)
436    }
437}
438impl core::fmt::Display for PanicStrategy {
439    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
440        f.write_str(self.as_str())
441    }
442}