Module build

Source
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, where os is the operating system name as returned by std::env::consts::OS, and arch is the computer architecture as returned by std::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 or release, 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.