Struct vergen::ConstantsFlags[][src]

pub struct ConstantsFlags { /* fields omitted */ }

Constants Flags

Use these to toggle off the generation of constants you won't use.

let mut actual_flags = ConstantsFlags::all();
actual_flags.toggle(ConstantsFlags::SHA_SHORT);
actual_flags.toggle(ConstantsFlags::BUILD_DATE);
actual_flags.toggle(ConstantsFlags::SEMVER_LIGHTWEIGHT);
actual_flags.toggle(ConstantsFlags::SEMVER_FROM_CARGO_PKG);

let expected_flags = ConstantsFlags::BUILD_TIMESTAMP |
    ConstantsFlags::SHA |
    ConstantsFlags::COMMIT_DATE |
    ConstantsFlags::RUSTC_HOST_TRIPLE |
    ConstantsFlags::SEMVER |
    ConstantsFlags::RUSTC_SEMVER |
    ConstantsFlags::RUSTC_CHANNEL |
    ConstantsFlags::REBUILD_ON_HEAD_CHANGE |
    ConstantsFlags::BRANCH |
    ConstantsFlags::RUSTC_COMMIT_HASH |
    ConstantsFlags::RUSTC_COMMIT_DATE |
    ConstantsFlags::RUSTC_LLVM_VERSION;

assert_eq!(actual_flags, expected_flags)

Implementations

impl ConstantsFlags[src]

pub const BUILD_TIMESTAMP: ConstantsFlags[src]

Generate the build timestamp constant.

2018-08-09T15:15:57.282334589+00:00

pub const BUILD_DATE: ConstantsFlags[src]

Generate the build date constant.

2018-08-09

pub const SHA: ConstantsFlags[src]

Generate the SHA constant.

75b390dc6c05a6a4aa2791cc7b3934591803bc22

pub const SHA_SHORT: ConstantsFlags[src]

Generate the short SHA constant.

75b390d

pub const COMMIT_DATE: ConstantsFlags[src]

Generate the commit date constant.

2018-08-08

pub const SEMVER: ConstantsFlags[src]

Generate the semver constant.

This defaults to the output of git describe. If that output is empty, the the CARGO_PKG_VERSION environment variable is used.

v0.1.0

pub const SEMVER_LIGHTWEIGHT: ConstantsFlags[src]

Generate the semver constant, including lightweight tags.

This defaults to the output of git describe --tags. If that output is empty, the the CARGO_PKG_VERSION environment variable is used.

v0.1.0

pub const REBUILD_ON_HEAD_CHANGE: ConstantsFlags[src]

Generate the cargo:rebuild-if-changed=.git/HEAD and the cargo:rebuild-if-changed=.git/<ref> cargo build output.

pub const SEMVER_FROM_CARGO_PKG: ConstantsFlags[src]

Generate the semver constant from CARGO_PKG_VERSION. This is mutually exclusive with the SEMVER flag.

0.1.0

pub const RUSTC_SEMVER: ConstantsFlags[src]

Generates the rustc compiler version.

1.43.1

pub const RUSTC_CHANNEL: ConstantsFlags[src]

Generates the channel the rust compiler is installed from.

nightly

pub const RUSTC_HOST_TRIPLE: ConstantsFlags[src]

Generate the host triple constant.

x86_64-unknown-linux-gnu

pub const BRANCH: ConstantsFlags[src]

Generate the branch name constant.

master

pub const RUSTC_COMMIT_HASH: ConstantsFlags[src]

Generates the rustc commit hash

abcdef123

pub const RUSTC_COMMIT_DATE: ConstantsFlags[src]

Generates the rustc commit date

01/22/21

pub const RUSTC_LLVM_VERSION: ConstantsFlags[src]

1.2.3

pub const fn empty() -> ConstantsFlags[src]

Returns an empty set of flags

pub const fn all() -> ConstantsFlags[src]

Returns the set containing all flags.

pub const fn bits(&self) -> u64[src]

Returns the raw value of the flags currently stored.

pub fn from_bits(bits: u64) -> Option<ConstantsFlags>[src]

Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

pub const fn from_bits_truncate(bits: u64) -> ConstantsFlags[src]

Convert from underlying bit representation, dropping any bits that do not correspond to flags.

pub const unsafe fn from_bits_unchecked(bits: u64) -> ConstantsFlags[src]

Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

pub const fn is_empty(&self) -> bool[src]

Returns true if no flags are currently stored.

pub const fn is_all(&self) -> bool[src]

Returns true if all flags are currently set.

pub const fn intersects(&self, other: ConstantsFlags) -> bool[src]

Returns true if there are flags common to both self and other.

pub const fn contains(&self, other: ConstantsFlags) -> bool[src]

Returns true all of the flags in other are contained within self.

pub fn insert(&mut self, other: ConstantsFlags)[src]

Inserts the specified flags in-place.

pub fn remove(&mut self, other: ConstantsFlags)[src]

Removes the specified flags in-place.

pub fn toggle(&mut self, other: ConstantsFlags)[src]

Toggles the specified flags in-place.

pub fn set(&mut self, other: ConstantsFlags, value: bool)[src]

Inserts or removes the specified flags depending on the passed value.

Trait Implementations

impl Binary for ConstantsFlags[src]

impl BitAnd<ConstantsFlags> for ConstantsFlags[src]

type Output = ConstantsFlags

The resulting type after applying the & operator.

fn bitand(self, other: ConstantsFlags) -> ConstantsFlags[src]

Returns the intersection between the two sets of flags.

impl BitAndAssign<ConstantsFlags> for ConstantsFlags[src]

fn bitand_assign(&mut self, other: ConstantsFlags)[src]

Disables all flags disabled in the set.

impl BitOr<ConstantsFlags> for ConstantsFlags[src]

type Output = ConstantsFlags

The resulting type after applying the | operator.

fn bitor(self, other: ConstantsFlags) -> ConstantsFlags[src]

Returns the union of the two sets of flags.

impl BitOrAssign<ConstantsFlags> for ConstantsFlags[src]

fn bitor_assign(&mut self, other: ConstantsFlags)[src]

Adds the set of flags.

impl BitXor<ConstantsFlags> for ConstantsFlags[src]

type Output = ConstantsFlags

The resulting type after applying the ^ operator.

fn bitxor(self, other: ConstantsFlags) -> ConstantsFlags[src]

Returns the left flags, but with all the right flags toggled.

impl BitXorAssign<ConstantsFlags> for ConstantsFlags[src]

fn bitxor_assign(&mut self, other: ConstantsFlags)[src]

Toggles the set of flags.

impl Clone for ConstantsFlags[src]

impl Copy for ConstantsFlags[src]

impl Debug for ConstantsFlags[src]

impl Eq for ConstantsFlags[src]

impl Extend<ConstantsFlags> for ConstantsFlags[src]

impl FromIterator<ConstantsFlags> for ConstantsFlags[src]

impl Hash for ConstantsFlags[src]

impl LowerHex for ConstantsFlags[src]

impl Not for ConstantsFlags[src]

type Output = ConstantsFlags

The resulting type after applying the ! operator.

fn not(self) -> ConstantsFlags[src]

Returns the complement of this set of flags.

impl Octal for ConstantsFlags[src]

impl Ord for ConstantsFlags[src]

impl PartialEq<ConstantsFlags> for ConstantsFlags[src]

impl PartialOrd<ConstantsFlags> for ConstantsFlags[src]

impl StructuralEq for ConstantsFlags[src]

impl StructuralPartialEq for ConstantsFlags[src]

impl Sub<ConstantsFlags> for ConstantsFlags[src]

type Output = ConstantsFlags

The resulting type after applying the - operator.

fn sub(self, other: ConstantsFlags) -> ConstantsFlags[src]

Returns the set difference of the two sets of flags.

impl SubAssign<ConstantsFlags> for ConstantsFlags[src]

fn sub_assign(&mut self, other: ConstantsFlags)[src]

Disables all flags enabled in the set.

impl UpperHex for ConstantsFlags[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RuleType for T where
    T: Eq + Ord + Copy + Debug + Hash
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.