Struct vergen::ConstantsFlags [−]
pub struct ConstantsFlags { /* fields omitted */ }
Constants Flags
Use these to toggle off the generation of constants you won't use.
let mut flags = ConstantsFlags::all(); flags.toggle(ConstantsFlags::SHA_SHORT); flags.toggle(ConstantsFlags::BUILD_DATE); flags.toggle(ConstantsFlags::SEMVER_LIGHTWEIGHT); assert_eq!( flags, ConstantsFlags::BUILD_TIMESTAMP & ConstantsFlags::SHA & ConstantsFlags::COMMIT_DATE & ConstantsFlags::TARGET_TRIPLE & ConstantsFlags::SEMVER )
Methods
impl ConstantsFlags
impl ConstantsFlags
pub const BUILD_TIMESTAMP: ConstantsFlags
BUILD_TIMESTAMP: ConstantsFlags = ConstantsFlags{bits: 1,}
Generate the build timestamp constant.
"2018-08-09T15:15:57.282334589+00:00"
pub const BUILD_DATE: ConstantsFlags
BUILD_DATE: ConstantsFlags = ConstantsFlags{bits: 2,}
Generate the build date constant.
"2018-08-09"
pub const SHA: ConstantsFlags
SHA: ConstantsFlags = ConstantsFlags{bits: 4,}
Generate the SHA constant.
"75b390dc6c05a6a4aa2791cc7b3934591803bc22"
pub const SHA_SHORT: ConstantsFlags
SHA_SHORT: ConstantsFlags = ConstantsFlags{bits: 8,}
Generate the short SHA constant.
"75b390d"
pub const COMMIT_DATE: ConstantsFlags
COMMIT_DATE: ConstantsFlags = ConstantsFlags{bits: 16,}
Generate the commit date constant.
"2018-08-08"
pub const TARGET_TRIPLE: ConstantsFlags
TARGET_TRIPLE: ConstantsFlags = ConstantsFlags{bits: 32,}
Generate the target triple constant.
"x86_64-unknown-linux-gnu"
pub const SEMVER: ConstantsFlags
SEMVER: ConstantsFlags = ConstantsFlags{bits: 64,}
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-pre.0"
pub const SEMVER_LIGHTWEIGHT: ConstantsFlags
SEMVER_LIGHTWEIGHT: ConstantsFlags = ConstantsFlags{bits: 128,}
Generate the semver constant, including lightweight tags.
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-pre.0"
pub const REBUILD_ON_HEAD_CHANGE: ConstantsFlags
REBUILD_ON_HEAD_CHANGE: ConstantsFlags = ConstantsFlags{bits: 256,}
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
SEMVER_FROM_CARGO_PKG: ConstantsFlags = ConstantsFlags{bits: 512,}
Generate the semver constant from CARGO_PKG_VERSION
. This is
mutually exclusive with the SEMVER
flag.
0.1.0
pub fn empty() -> ConstantsFlags
pub fn empty() -> ConstantsFlags
Returns an empty set of flags.
pub fn all() -> ConstantsFlags
pub fn all() -> ConstantsFlags
Returns the set containing all flags.
pub fn bits(&self) -> u32
pub fn bits(&self) -> u32
Returns the raw value of the flags currently stored.
pub fn from_bits(bits: u32) -> Option<ConstantsFlags>
pub fn from_bits(bits: u32) -> Option<ConstantsFlags>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
pub fn from_bits_truncate(bits: u32) -> ConstantsFlags
pub fn from_bits_truncate(bits: u32) -> ConstantsFlags
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
pub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if no flags are currently stored.
pub fn is_all(&self) -> bool
pub fn is_all(&self) -> bool
Returns true
if all flags are currently set.
pub fn intersects(&self, other: ConstantsFlags) -> bool
pub fn intersects(&self, other: ConstantsFlags) -> bool
Returns true
if there are flags common to both self
and other
.
pub fn contains(&self, other: ConstantsFlags) -> bool
pub fn contains(&self, other: ConstantsFlags) -> bool
Returns true
all of the flags in other
are contained within self
.
pub fn insert(&mut self, other: ConstantsFlags)
pub fn insert(&mut self, other: ConstantsFlags)
Inserts the specified flags in-place.
pub fn remove(&mut self, other: ConstantsFlags)
pub fn remove(&mut self, other: ConstantsFlags)
Removes the specified flags in-place.
pub fn toggle(&mut self, other: ConstantsFlags)
pub fn toggle(&mut self, other: ConstantsFlags)
Toggles the specified flags in-place.
pub fn set(&mut self, other: ConstantsFlags, value: bool)
pub fn set(&mut self, other: ConstantsFlags, value: bool)
Inserts or removes the specified flags depending on the passed value.
Trait Implementations
impl Copy for ConstantsFlags
impl Copy for ConstantsFlags
impl PartialEq for ConstantsFlags
impl PartialEq for ConstantsFlags
fn eq(&self, other: &ConstantsFlags) -> bool
fn eq(&self, other: &ConstantsFlags) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &ConstantsFlags) -> bool
fn ne(&self, other: &ConstantsFlags) -> bool
This method tests for !=
.
impl Eq for ConstantsFlags
impl Eq for ConstantsFlags
impl Clone for ConstantsFlags
impl Clone for ConstantsFlags
fn clone(&self) -> ConstantsFlags
fn clone(&self) -> ConstantsFlags
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialOrd for ConstantsFlags
impl PartialOrd for ConstantsFlags
fn partial_cmp(&self, other: &ConstantsFlags) -> Option<Ordering>
fn partial_cmp(&self, other: &ConstantsFlags) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &ConstantsFlags) -> bool
fn lt(&self, other: &ConstantsFlags) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &ConstantsFlags) -> bool
fn le(&self, other: &ConstantsFlags) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &ConstantsFlags) -> bool
fn gt(&self, other: &ConstantsFlags) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &ConstantsFlags) -> bool
fn ge(&self, other: &ConstantsFlags) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for ConstantsFlags
impl Ord for ConstantsFlags
fn cmp(&self, other: &ConstantsFlags) -> Ordering
fn cmp(&self, other: &ConstantsFlags) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Hash for ConstantsFlags
impl Hash for ConstantsFlags
fn hash<__H: Hasher>(&self, state: &mut __H)
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for ConstantsFlags
impl Debug for ConstantsFlags
impl Binary for ConstantsFlags
impl Binary for ConstantsFlags
impl Octal for ConstantsFlags
impl Octal for ConstantsFlags
impl LowerHex for ConstantsFlags
impl LowerHex for ConstantsFlags
impl UpperHex for ConstantsFlags
impl UpperHex for ConstantsFlags
impl BitOr for ConstantsFlags
impl BitOr for ConstantsFlags
type Output = ConstantsFlags
The resulting type after applying the |
operator.
fn bitor(self, other: ConstantsFlags) -> ConstantsFlags
fn bitor(self, other: ConstantsFlags) -> ConstantsFlags
Returns the union of the two sets of flags.
impl BitOrAssign for ConstantsFlags
impl BitOrAssign for ConstantsFlags
fn bitor_assign(&mut self, other: ConstantsFlags)
fn bitor_assign(&mut self, other: ConstantsFlags)
Adds the set of flags.
impl BitXor for ConstantsFlags
impl BitXor for ConstantsFlags
type Output = ConstantsFlags
The resulting type after applying the ^
operator.
fn bitxor(self, other: ConstantsFlags) -> ConstantsFlags
fn bitxor(self, other: ConstantsFlags) -> ConstantsFlags
Returns the left flags, but with all the right flags toggled.
impl BitXorAssign for ConstantsFlags
impl BitXorAssign for ConstantsFlags
fn bitxor_assign(&mut self, other: ConstantsFlags)
fn bitxor_assign(&mut self, other: ConstantsFlags)
Toggles the set of flags.
impl BitAnd for ConstantsFlags
impl BitAnd for ConstantsFlags
type Output = ConstantsFlags
The resulting type after applying the &
operator.
fn bitand(self, other: ConstantsFlags) -> ConstantsFlags
fn bitand(self, other: ConstantsFlags) -> ConstantsFlags
Returns the intersection between the two sets of flags.
impl BitAndAssign for ConstantsFlags
impl BitAndAssign for ConstantsFlags
fn bitand_assign(&mut self, other: ConstantsFlags)
fn bitand_assign(&mut self, other: ConstantsFlags)
Disables all flags disabled in the set.
impl Sub for ConstantsFlags
impl Sub for ConstantsFlags
type Output = ConstantsFlags
The resulting type after applying the -
operator.
fn sub(self, other: ConstantsFlags) -> ConstantsFlags
fn sub(self, other: ConstantsFlags) -> ConstantsFlags
Returns the set difference of the two sets of flags.
impl SubAssign for ConstantsFlags
impl SubAssign for ConstantsFlags
fn sub_assign(&mut self, other: ConstantsFlags)
fn sub_assign(&mut self, other: ConstantsFlags)
Disables all flags enabled in the set.
impl Not for ConstantsFlags
impl Not for ConstantsFlags
type Output = ConstantsFlags
The resulting type after applying the !
operator.
fn not(self) -> ConstantsFlags
fn not(self) -> ConstantsFlags
Returns the complement of this set of flags.
impl Extend<ConstantsFlags> for ConstantsFlags
impl Extend<ConstantsFlags> for ConstantsFlags
fn extend<T: IntoIterator<Item = ConstantsFlags>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = ConstantsFlags>>(&mut self, iterator: T)
Extends a collection with the contents of an iterator. Read more
impl FromIterator<ConstantsFlags> for ConstantsFlags
impl FromIterator<ConstantsFlags> for ConstantsFlags
fn from_iter<T: IntoIterator<Item = ConstantsFlags>>(
iterator: T
) -> ConstantsFlags
fn from_iter<T: IntoIterator<Item = ConstantsFlags>>(
iterator: T
) -> ConstantsFlags
Creates a value from an iterator. Read more
Auto Trait Implementations
impl Send for ConstantsFlags
impl Send for ConstantsFlags
impl Sync for ConstantsFlags
impl Sync for ConstantsFlags