Rust has the ability to check configuration at build time with, e.g., #[cfg(target_os = \"linux\")] or if cfg!(target_os = \"linux\") {...}, where
See also https://internals.rust-lang.org/t/all-the-rust-features/4322 for a comprehensive list of features.
Bear in mind that some / most of the features won't be stabilized so will only be available in nightly for some time and are subject to breaking improvements / upgrades until they are either stabilized or discontinued.
Features in rust nightly is survival of the fittest.
You can also use this command: rustc --print target-list.
Each triple are formatted as follows: {arch}-{vendor}-{sys}-{abi}.
For example, the triple 'arm-unknown-linux-gnueabihf' refers to:
The "Conditional compilation" section of the Reference has a list of configurations that must be defined (as of Rust 1.14):
target_arch with values like:
x86 x86_64mipspowerpcpowerpc64armaarch64target_os with values like:
windowsmacosioslinuxandroidfreebsddragonflybitrigopenbsdnetbsdtarget_family with values like:
unixwindowsunix (shortcut for target_family)windows (shortcut for target_family)target_env with values like:
gnumsvcmusl"" (empty string)target_endian with values:
littlebigtarget_pointer_width with values like:
3264target_has_atomic with values like:
8163264ptrtarget_vendor with values like:
applepcunknowntestdebug_assertions