| 1 |
//! Parsing of `rustc` target names to match the values exposed to Cargo |
| 2 |
//! build scripts (`CARGO_CFG_*`). |
| 3 |
|
| 4 |
mod apple; |
| 5 |
mod generated; |
| 6 |
mod llvm; |
| 7 |
mod parser; |
| 8 |
|
| 9 |
pub(crate) use parser::TargetInfoParser; |
| 10 |
|
| 11 |
/// Information specific to a `rustc` target. |
| 12 |
/// |
| 13 |
/// See <https://doc.rust-lang.org/cargo/appendix/glossary.html#target>. |
| 14 |
#[derive(Debug, PartialEq, Clone)] |
| 15 |
pub(crate) struct TargetInfo<'a> { |
| 16 |
/// The full architecture, including the subarchitecture. |
| 17 |
/// |
| 18 |
/// This differs from `cfg!(target_arch)`, which only specifies the |
| 19 |
/// overall architecture, which is too coarse for certain cases. |
| 20 |
pub full_arch: &'a str, |
| 21 |
/// The overall target architecture. |
| 22 |
/// |
| 23 |
/// This is the same as the value of `cfg!(target_arch)`. |
| 24 |
pub arch: &'a str, |
| 25 |
/// The target vendor. |
| 26 |
/// |
| 27 |
/// This is the same as the value of `cfg!(target_vendor)`. |
| 28 |
pub vendor: &'a str, |
| 29 |
/// The operating system, or `none` on bare-metal targets. |
| 30 |
/// |
| 31 |
/// This is the same as the value of `cfg!(target_os)`. |
| 32 |
pub os: &'a str, |
| 33 |
/// The environment on top of the operating system. |
| 34 |
/// |
| 35 |
/// This is the same as the value of `cfg!(target_env)`. |
| 36 |
pub env: &'a str, |
| 37 |
/// The ABI on top of the operating system. |
| 38 |
/// |
| 39 |
/// This is the same as the value of `cfg!(target_abi)`. |
| 40 |
pub abi: &'a str, |
| 41 |
} |