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 | apple-darwin |
VERGEN_RUSTC_LLVM_VERSION | 11.0 |
VERGEN_RUSTC_SEMVER | 1.52.0-nightly |
§Example
Emit all of the rustc instructions
let rustc = Rustc::all_rustc();
Emitter::default().add_instructions(&rustc)?.emit();Emit some of the rustc instructions
let rustc = Rustc::builder().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 = Rustc::builder().channel(true).semver(true).build();
Emitter::default().add_instructions(&rustc)?.emit();
Ok(())
}();
assert!(result.is_ok());
});Implementations§
Trait Implementations§
Source§impl Add for Rustc
impl Add for Rustc
Source§fn add_map_entries(
&self,
_idempotent: bool,
cargo_rustc_env: &mut BTreeMap<VergenKey, String>,
_cargo_rerun_if_changed: &mut Vec<String>,
cargo_warning: &mut Vec<String>,
) -> Result<(), Error>
fn add_map_entries( &self, _idempotent: bool, cargo_rustc_env: &mut BTreeMap<VergenKey, String>, _cargo_rerun_if_changed: &mut Vec<String>, cargo_warning: &mut Vec<String>, ) -> Result<(), Error>
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 BTreeMap<VergenKey, String>,
_cargo_rerun_if_changed: &mut Vec<String>,
cargo_warning: &mut Vec<String>,
) -> Result<(), Error>
fn add_default_entries( &self, config: &DefaultConfig, cargo_rustc_env_map: &mut BTreeMap<VergenKey, String>, _cargo_rerun_if_changed: &mut Vec<String>, cargo_warning: &mut Vec<String>, ) -> Result<(), Error>
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