pub struct AppDetails { /* private fields */ }
Expand description
Application details.
§Configuration
This struct is generated at build time and contains information about the detected application name and version based on detected environment variables. The following environment variables are used:
APP_FULL_NAME
: Application’s full name. If this is not set, the default value is “unknown”.APP_SHORT_NAME
: Application’s short name. If this is not set, the default value is “unknown”.APP_IDENTIFIER
: Application’s identifier. If this is not set, the default value is “unknown”.APP_VERSION
: Version of the application. If this is not set, the default value is “0.0.0”.APP_GIT_HASH
: Git hash of the application. If this is not set, the default value is “unknown”.APP_BUILD_TIME
: Build time of the application. If this is not set, the default value is “0000-00-00 00:00:00”.APP_DEV_BUILD
: Whether the application is a development build. If this is not set, the default value istrue
.TARGET
: Target architecture of the application. If this is not set, the default value is “unknown-arch”.
Environment variables prefixed with APP_
are expected to be set by the build script/tooling, while others are
provided automatically by Cargo.
The version string will be treated as a semantic version, and will be split on periods to extract the major, minor, and patch numbers. Additionally, the patch number will be split on hyphens to remove any pre-release or build metadata.
Implementations§
Source§impl AppDetails
impl AppDetails
Sourcepub fn full_name(&self) -> &'static str
pub fn full_name(&self) -> &'static str
Returns the application’s full name.
This is typically a human-friendly/“pretty” name of the binary/executable, such as “Agent Data Plane”.
If the full name could not be detected, this will return “unknown”.
Sourcepub fn short_name(&self) -> &'static str
pub fn short_name(&self) -> &'static str
Returns the application’s short name.
This is typically a shorter version of the name of the binary/executable, such as “Data Plane” or “DATAPLANE”.
If the short name could not be detected, this will return “unknown”.
Sourcepub fn identifier(&self) -> &'static str
pub fn identifier(&self) -> &'static str
Returns the application’s identifier.
This is typically a very condensed form of the name of the binary/executable, like an acronym, such as “adp” or “ADP”.
If the identifier could not be detected, this will return “unknown”.
Sourcepub fn git_hash(&self) -> &'static str
pub fn git_hash(&self) -> &'static str
Returns the Git hash used to build the application.
If the Git hash could not be detected, this will return “unknown”.
Sourcepub fn version(&self) -> &Version
pub fn version(&self) -> &Version
Returns the application’s version.
If the version could not be detected, this will return a version equivalent to 0.0.0
.
Sourcepub fn build_time(&self) -> &'static str
pub fn build_time(&self) -> &'static str
Returns the build time of the application.
If the build time could not be detected, this will return “0000-00-00 00:00:00”.
Sourcepub fn is_dev_build(&self) -> bool
pub fn is_dev_build(&self) -> bool
Returns true
if this application is a development build.
Development builds generally encompass all local builds, and any CI builds which are not related to versioned artifacts intended for public release.
If the development build flag could not be detected, this will return true
.
Sourcepub fn target_arch(&self) -> &'static str
pub fn target_arch(&self) -> &'static str
Returns the target architecture of the application.
This returns a “target triple”, which is a string that generally has four components: the processor architecture (x86-64, ARM64, etc), the “vendor” (“apple”, “pc”, etc), the operating system (“linux”, “windows”, “darwin”, etc) and environment/ABI (“gnu”, “musl”, etc).
The environment/ABI component can sometimes be omitted in scenarios where there are no meaningful distinctions for the given operating system.
If the target architecture could not be detected, this will return “unknown-arch”.