[][src]Crate rustc_cfg

Runs rustc --print cfg and parses the output

NOTE: If you are in build script context you should prefer to use the CARGO_CFG_* env variables that Cargo sets over this crate.

Requirements

  • This crate requires rustc to be installed and available in the user's PATH.

How to use

extern crate rustc_cfg;

use rustc_cfg::Cfg;

fn main() {
    let cfg = Cfg::of("x86_64-unknown-linux-gnu").unwrap();

    assert_eq!(cfg.target_arch, "x86_64");
    assert!(cfg.target_family.as_ref().map(|f| f == "unix").unwrap_or(false));
}

Structs

Cfg

The result of parsing the output of rustc --print cfg