[][src]Struct cargo_rustc_cfg::Cfg

pub struct Cfg { /* fields omitted */ }

A container for the parsed output from the cargo rustc --lib -- --print cfg command.

Implementations

impl Cfg[src]

pub fn host() -> Result<Self, Error>[src]

Obtains the host configuration.

This is a helper method for using the CargoRustcPrintCfg, such that:

let cfg = CargoRustcPrintCfg::default().execute()?;

becomes:

let cfg = Cfg::host()?;

pub fn rustc_target<S>(t: S) -> Result<Self, Error> where
    S: AsRef<OsStr>, 
[src]

Obtains a configuration for a Rust compiler (rustc) target.

This is a helper method for using the CargoRustcPrintCfg, such that:

let cfg = CargoRustcPrintCfg::default().rustc_target("x86_64-pc-windows-msvc").execute()?;

becomes:

let cfg = Cfg::rustc_target("x86_64-pc-windows-msvc")?;

pub fn extras(&self) -> Vec<&str>[src]

Any and all additional lines from the output of the cargo rustc --print cfg command that are not recognized as target key-value pairs.

These are any lines that were not recognized as target key-value lines, i.e. key="value". Unlike the target key-value lines, any double quotes, ", are not removed.

Examples

let cfg = Cfg::rustc_target("x86_64-pc-windows-msvc")?;
assert!(cfg.extras().contains(&"debug_assertions"));
assert!(cfg.extras().contains(&"windows"));

pub fn target(&self) -> &Target[src]

All output that is prepended by the target_ string.

These are all the recognized target key-value lines, i.e. target_<key>="<value>". The double quotes, " are removed for the values.

pub fn into_target(self) -> Target[src]

Consumes this configuration and converts it into the target configuration.

The target configuration is all recognized key-value lines prepended with the target_ string.

Trait Implementations

impl Clone for Cfg[src]

impl Debug for Cfg[src]

impl PartialEq<Cfg> for Cfg[src]

impl StructuralPartialEq for Cfg[src]

Auto Trait Implementations

impl RefUnwindSafe for Cfg

impl Send for Cfg

impl Sync for Cfg

impl Unpin for Cfg

impl UnwindSafe for Cfg

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.