pub struct Rustc { /* private fields */ }
Available on crate feature
rustc
only.Expand description
The VERGEN_RUSTC_*
configuration features
NOTE - All rustc instructions are considered deterministic. If you change the version of rustc you are compiling with, these values should change if being used in the generated binary.
Variable | Sample |
---|---|
VERGEN_RUSTC_CHANNEL | nightly |
VERGEN_RUSTC_COMMIT_DATE | 2021-02-24 |
VERGEN_RUSTC_COMMIT_HASH | a8486b64b0c87dabd045453b6c81500015d122d6 |
VERGEN_RUSTC_HOST_TRIPLE | x86_64-apple-darwin |
VERGEN_RUSTC_LLVM_VERSION | 11.0 |
VERGEN_RUSTC_SEMVER | 1.52.0-nightly |
§Example
Emit all of the rustc instructions
let rustc = RustcBuilder::all_rustc()?;
Emitter::default().add_instructions(&rustc)?.emit();
Emit some of the rustc instructions
let rustc = RustcBuilder::default().channel(true).semver(true).build()?;
Emitter::default().add_instructions(&rustc)?.emit();
Override output with your own value
temp_env::with_var("VERGEN_RUSTC_CHANNEL", Some("this is the channel I want output"), || {
let result = || -> Result<()> {
let rustc = RustcBuilder::default().channel(true).semver(true).build()?;
Emitter::default().add_instructions(&rustc)?.emit();
Ok(())
}();
assert!(result.is_ok());
});
Trait Implementations§
Source§impl Add for Rustc
impl Add for Rustc
Source§fn add_map_entries(
&self,
_idempotent: bool,
cargo_rustc_env: &mut CargoRustcEnvMap,
_cargo_rerun_if_changed: &mut CargoRerunIfChanged,
cargo_warning: &mut CargoWarning,
) -> Result<()>
fn add_map_entries( &self, _idempotent: bool, cargo_rustc_env: &mut CargoRustcEnvMap, _cargo_rerun_if_changed: &mut CargoRerunIfChanged, cargo_warning: &mut CargoWarning, ) -> Result<()>
Try to add instructions entries to the various given arguments. Read more
Source§fn add_default_entries(
&self,
config: &DefaultConfig,
cargo_rustc_env_map: &mut CargoRustcEnvMap,
_cargo_rerun_if_changed: &mut CargoRerunIfChanged,
cargo_warning: &mut CargoWarning,
) -> Result<()>
fn add_default_entries( &self, config: &DefaultConfig, cargo_rustc_env_map: &mut CargoRustcEnvMap, _cargo_rerun_if_changed: &mut CargoRerunIfChanged, cargo_warning: &mut CargoWarning, ) -> Result<()>
Based on the given configuration, emit either default idempotent output or generate a failue. Read more
impl Copy for Rustc
impl StructuralPartialEq for Rustc
Auto Trait Implementations§
impl Freeze for Rustc
impl RefUnwindSafe for Rustc
impl Send for Rustc
impl Sync for Rustc
impl Unpin for Rustc
impl UnwindSafe for Rustc
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more