vergen

Struct Rustc

Source
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.

VariableSample
VERGEN_RUSTC_CHANNELnightly
VERGEN_RUSTC_COMMIT_DATE2021-02-24
VERGEN_RUSTC_COMMIT_HASHa8486b64b0c87dabd045453b6c81500015d122d6
VERGEN_RUSTC_HOST_TRIPLEx86_64-apple-darwin
VERGEN_RUSTC_LLVM_VERSION11.0
VERGEN_RUSTC_SEMVER1.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

Source§

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<()>

Based on the given configuration, emit either default idempotent output or generate a failue. Read more
Source§

impl Clone for Rustc

Source§

fn clone(&self) -> Rustc

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Rustc

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Rustc

Source§

fn eq(&self, other: &Rustc) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Rustc

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.