Struct target_build_utils::TargetInfo [] [src]

pub struct TargetInfo {
    // some fields omitted
}

Methods

impl TargetInfo
[src]

fn new() -> Result<TargetInfoError>

Parse the target info from TARGET environment variable

TARGET environment variable is usually set for you in build.rs scripts, therefore this function is all that’s necessary in majority of cases.

Example

use target_build_utils::TargetInfo;
let target = TargetInfo::new().expect("could not get target");

fn from_str(s: &str) -> Result<TargetInfoError>

Calculate the target info from the provided target value

String may contain a triple or path to the json file.

Example

use target_build_utils::TargetInfo;
let target = TargetInfo::from_str("x86_64-unknown-linux-gnu")
    .expect("could not get target");

impl TargetInfo
[src]

fn target_arch(&self) -> &str

Architecture of the targeted machine

Corresponds to the #[cfg(target_arch)] in Rust code.

fn target_vendor(&self) -> &str

Vendor of the targeted machine

Corresponds to the #[cfg(target_vendor)] in Rust code.

fn target_os(&self) -> &str

OS of the targeted machine

Corresponds to the #[cfg(target_os)] in Rust code.

fn target_env(&self) -> &str

Environment (ABI) of the targeted machine

Corresponds to the #[cfg(target_env)] in Rust code.

fn target_endian(&self) -> &str

Endianess of the targeted machine

Valid values are: little and big.

Corresponds to the #[cfg(target_endian)] in Rust code.

fn target_pointer_width(&self) -> &str

Pointer width of the targeted machine

Corresponds to the #[cfg(target_pointer_width)] in Rust code.