Struct vergen::Build

source ·
pub struct Build { /* private fields */ }
Expand description

Configuration for the VERGEN_BUILD_* instructions

Instructions

The following instructions can be generated:

InstructionDefault
cargo:rustc-env=VERGEN_BUILD_DATE=2021-02-12
cargo:rustc-env=VERGEN_BUILD_TIME=11:22:34
cargo:rustc-env=VERGEN_BUILD_TIMESTAMP=2021-02-12T01:54:15.134750+00:00*
cargo:rustc-env=VERGEN_BUILD_SEMVER=4.2.0*
  • If the timestamp field is false, the date/time instructions will not be generated.
  • If the semver field is false, the semver instruction will not be generated.
  • NOTE - By default, the date/time related instructions will use UTC.
  • NOTE - The date/time instruction output is determined by the kind field and can be any combination of the three.
  • NOTE - To keep processing other sections if an Error occurs in this one, set Build::skip_if_error to true.
  • NOTE - If the SOURCE_DATE_EPOCH environment variable is set, vergen will use the value of that variable in place of the current time.

Example

use vergen::{vergen, Config};
use vergen::TimestampKind;

let mut config = Config::default();
// Generate all three date/time instructions
*config.build_mut().kind_mut() = TimestampKind::All;

// Generate the instructions
vergen(config)?;

Implementations§

source§

impl Build

source

pub fn enabled_mut(&mut self) -> &mut bool

Enable/Disable the build output

source

pub fn timestamp_mut(&mut self) -> &mut bool

Enable/Disable the VERGEN_BUILD_DATE, VERGEN_BUILD_TIME, and VERGEN_BUILD_TIMESTAMP instructions.

source

pub fn timezone_mut(&mut self) -> &mut TimeZone

The timezone to use for the date/time instructions.

source

pub fn kind_mut(&mut self) -> &mut TimestampKind

The kind of date/time instructions to output.

source

pub fn semver_mut(&mut self) -> &mut bool

Enable/Disable the VERGEN_BUILD_SEMVER instruction.

source

pub fn skip_if_error_mut(&mut self) -> &mut bool

Enable/Disable skipping Build if an Error occurs. Use option_env! to read the generated environment variables.

Trait Implementations§

source§

impl Clone for Build

source§

fn clone(&self) -> Build

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 Build

source§

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

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

impl Default for Build

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Copy for Build

Auto Trait Implementations§

§

impl RefUnwindSafe for Build

§

impl Send for Build

§

impl Sync for Build

§

impl Unpin for Build

§

impl UnwindSafe for Build

Blanket Implementations§

source§

impl<T> Any for Twhere
T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere
T: Clone,

§

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 Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.