Expand description
A crate that provides programmatic access to information about the current build target inside build.rs
.
§Examples
Prints all available information about the current build target.
// inside build.rs
fn main() {
// The panic is just used to print the information to the console.
panic!("current build target: {:#?}",
build_target::target().unwrap()
);
}
Gets the parts of the current build target individually.
// inside build.rs
fn main() {
let arch = build_target::target_arch().unwrap(); // eg. "x86_64", "aarch64", ...
let endian = build_target::target_endian().unwrap(); // eg. "big", "little", ...
let env = build_target::target_env().unwrap(); // eg. "gnu", "msvc", ...
let family = build_target::target_family().unwrap(); // eg. "windows", "unix", ...
let pw = build_target::target_pointer_width().unwrap(); // eg. "32", "64", ...
let os = build_target::target_os().unwrap(); // eg. "android", "linux", ...
let vendor = build_target::target_vendor().unwrap(); // eg. "apple", "unknown", ...
let triple = build_target::target_triple().unwrap(); // eg. "x86_64-unknown-linux-gnu", ...
}
Structs§
- Target
- Combined information about a build target.
Enums§
- Arch
- Target CPU architecture
- Endian
- The endianness of the target architecture.
- Env
- Target enviroment that disambiguates the target platform by ABI / libc.
- Family
- A more generic description of a target, such as the family of the operating systems or architectures that the target generally falls into.
- Os
- Operating system of the target.
- Pointer
Width - The endianness of the target architecture.
- Profile
- Profile of the current build.
- Vendor
- The vendor of the target platform, such as the manufacturer of the hardware or the provider of the operating system.
Functions§
- target
- Gets the current target information as a
Target
. This function is equivalent toTarget::current()
. - target_
arch - Gets the current target
Arch
. This function is equivalent toArch::target()
. - target_
endian - Gets the current target
Endian
. This function is equivalent toEndian::target()
. - target_
env - Gets the current target
Env
. This function is equivalent toEnv::target()
. - target_
family - Gets the current target
Family
. This function is equivalent toFamily::target()
. - target_
os - Gets the current target
Os
. This function is equivalent toOs::target()
. - target_
pointer_ width - Gets the current target
PointerWidth
. This function is equivalent toPointerWidth::target()
. - target_
triple - Gets the current target triple.
- target_
vendor - Gets the current target
Vendor
. This function is equivalent toVendor::target()
.