pub struct BuildEnv { /* private fields */ }
Expand description
Allow retrieval of values pretaining to a build
process that may be related to the target
and/or host
triple.
Implementations§
Source§impl BuildEnv
impl BuildEnv
Sourcepub fn from_env() -> Result<BuildEnv, VarError<String>>
pub fn from_env() -> Result<BuildEnv, VarError<String>>
Use environment variables (such as those set by cargo) to determine values for target
and
host
via the environment variables TARGET
and HOST
.
Sourcepub fn new_cross(host: String, target: String) -> BuildEnv
pub fn new_cross(host: String, target: String) -> BuildEnv
Construct a BuildEnv where the host and target may be different.
Sourcepub fn used_env_vars(&self) -> impl Iterator<Item = &OsString>
pub fn used_env_vars(&self) -> impl Iterator<Item = &OsString>
Get the env vars that have been used by build-env queries so far
Sourcepub fn cargo_print_used_env_vars(&self)
pub fn cargo_print_used_env_vars(&self)
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)
Sourcepub fn var<K: AsRef<OsStr>>(&mut self, var_base: K) -> Option<OsString>
pub fn var<K: AsRef<OsStr>>(&mut self, var_base: K) -> Option<OsString>
Query the environment for a value, trying the most specific first, before querying more general variables.
<var>_<target>
- for example,CC_x86_64-unknown-linux-gnu
<var>_<target_with_underscores>
- for example,CC_x86_64_unknown_linux_gnu
<build-kind>_<var>
- for example,HOST_CC
orTARGET_CFLAGS
<var>
- a plainCC
,AR
as above.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BuildEnv
impl RefUnwindSafe for BuildEnv
impl Send for BuildEnv
impl Sync for BuildEnv
impl Unpin for BuildEnv
impl UnwindSafe for BuildEnv
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more