Struct build_env::BuildEnv[][src]

pub struct BuildEnv { /* fields omitted */ }

Allow retrieval of values pretaining to a build process that may be related to the target and/or host triple.

Implementations

impl BuildEnv[src]

pub fn from_env() -> Result<BuildEnv, VarError<String>>[src]

Use environment variables (such as those set by cargo) to determine values for target and host via the environment variables TARGET and HOST.

pub fn new_cross(host: String, target: String) -> BuildEnv[src]

Construct a BuildEnv where the host and target may be different.

pub fn new(trip: String) -> BuildEnv[src]

Construct a BuildEnv where target and host are the same.

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

The target we’re supplying values for

pub fn host(&self) -> &str[src]

The host we’re supplying values for

pub fn used_env_vars(&self) -> impl Iterator<Item = &OsString>[src]

Get the env vars that have been used by build-env queries so far

pub fn cargo_print_used_env_vars(&self)[src]

Print the used environment variables in the form interpreted by cargo: cargo:rerun-if-env-changed=FOO

pub fn mark_used(&mut self, var: OsString)[src]

pub fn var<K: AsRef<OsStr>>(&mut self, var_base: K) -> Option<OsString>[src]

Query the environment for a value, trying the most specific first, before querying more general variables.

  1. <var>_<target> - for example, CC_x86_64-unknown-linux-gnu
  2. <var>_<target_with_underscores> - for example, CC_x86_64_unknown_linux_gnu
  3. <build-kind>_<var> - for example, HOST_CC or TARGET_CFLAGS
  4. <var> - a plain CC, AR as above.

pub fn var_str<K: AsRef<OsStr> + Debug + Any>(
    &mut self,
    var_base: K
) -> Option<Result<String, VarError<K>>>
[src]

The same as [var()], but converts the return to an OsString and provides a useful error message

Trait Implementations

impl Clone for BuildEnv[src]

fn clone(&self) -> BuildEnv[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for BuildEnv[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.