Expand description
shadow-rs mod
Constants§
- BRANCH
- The name of the Git branch that this project was built from. This constant will be empty if the branch cannot be determined.
- BUILD_
OS - Operating system and architecture on which the project was build.
The format of this variable is always
os-arch
, whereos
is the operating system name as returned bystd::env::consts::OS
, andarch
is the computer architecture as returned bystd::env::consts::ARCH
. - BUILD_
RUST_ CHANNEL - The debug configuration with which the project was built.
Note that this is not the Rust channel, but either
debug
orrelease
, depending on whether debug assertions were enabled in the build or not. - BUILD_
TARGET - The target for this build. This is possibly distinct from the host target during build, in which case this project build was created via cross-compilation.
- BUILD_
TARGET_ ARCH - The architecture of the target for this build. This is the “architecture” part of the
BUILD_TARGET
constant. - BUILD_
TIME - The project build time, formatted in modified ISO 8601 format (
YYYY-MM-DD HH-MM ±hh-mm
where hh-mm is the offset from UTC). - BUILD_
TIME_ 2822 - The project build time, formatted according to RFC 2822 (e.g. HTTP Headers).
- BUILD_
TIME_ 3339 - The project build time, formatted according to RFC 3339 and ISO 8601.
- CARGO_
VERSION - The cargo version which which the project was built, as output by
cargo --version
. - CLAP_
LONG_ VERSION - A long version string describing the project. The version string contains the package version, branch, commit hash, build time, and build environment on separate lines. This constant is intended to be used by clap or other CLI tools as a long version string.
- COMMITS_
SINCE_ TAG - The number of commits since the last Git tag on the branch that this project was built from. This value indicates how many commits have been made after the last tag and before the current commit.
- COMMIT_
DATE - The time of the Git commit that this project was built from.
The time is formatted in modified ISO 8601 format (
YYYY-MM-DD HH-MM ±hh-mm
where hh-mm is the offset from UTC). - COMMIT_
DATE_ 2822 - The name of the Git branch that this project was built from. The time is formatted according to RFC 2822 (e.g. HTTP Headers).
- COMMIT_
DATE_ 3339 - The name of the Git branch that this project was built from. The time is formatted according to RFC 3339 and ISO 8601.
- COMMIT_
HASH - The full commit hash of the Git commit that this project was built from.
An abbreviated, but not necessarily unique, version of this is
SHORT_COMMIT
. - GIT_
CLEAN - Whether the Git working tree was clean at the time of project build (
true
), or not (false
). - GIT_
STATUS_ FILE - The Git working tree status as a list of files with their status, similar to
git status
. Each line of the list is preceded with*
, followed by the file name. Files marked(dirty)
have unstaged changes. Files marked(staged)
have staged changes. - LAST_
TAG - The name of the last Git tag on the branch that this project was built from.
As opposed to
TAG
, this does not require the current commit to be tagged, just one of its parents. - PKG_
DESCRIPTION - The project’s description, as determined by the Cargo.toml manifest.
- PKG_
VERSION - The project’s full version string, as determined by the Cargo.toml manifest.
- PKG_
VERSION_ MAJOR - The project’s semver major version, as determined by the Cargo.toml manifest.
- PKG_
VERSION_ MINOR - The project’s semver minor version, as determined by the Cargo.toml manifest.
- PKG_
VERSION_ PATCH - The project’s semver patch version, as determined by the Cargo.toml manifest.
- PKG_
VERSION_ PRE - The project’s semver pre-release version, as determined by the Cargo.toml manifest.
- PROJECT_
NAME - The project name, as determined by the Cargo.toml manifest.
- RUST_
CHANNEL - The Rustup toolchain with which the project was built. Note that as per Rustup toolchain format, this variable may or may not contain host and date information, but it will always contain channel information (stable, beta or nightly).
- RUST_
VERSION - Rust version with which the project was built.
The version always uses the canonical Rust version format,
and is therefore identical to the output of the build toolchain’s
rustc --version
. - SHORT_
COMMIT - The short hash of the Git commit that this project was built from.
Note that this will always truncate
COMMIT_HASH
to 8 characters if necessary. Depending on the amount of commits in your project, this may not yield a unique Git identifier (see here for more details on hash abbreviation). - TAG
- The name of the Git tag that this project was built from. Note that this will be empty if there is no tag for the HEAD at the time of build.
- VERSION
- A long version string describing the project. The version string contains the package version, branch, commit hash, build time, and build environment on separate lines. This constant is suitable for printing to the user.
Functions§
- print_
build_ in - Prints all built-in
shadow-rs
build constants to standard output.