pub struct VersionInfo {
pub version: String,
pub git_commit: String,
pub git_branch: String,
pub build_time: String,
pub rust_version: String,
pub is_release: bool,
}Expand description
Immutable snapshot of build/version metadata. Compatible with gokit and pykit VersionInfo.
Fields§
§version: StringCrate version from Cargo.toml (e.g. "0.1.0-alpha.1").
git_commit: StringFull git commit hash at build time, or empty if unavailable.
git_branch: StringGit branch name at build time, or empty if unavailable.
build_time: StringUTC build timestamp in RFC 3339 format, or empty if unavailable.
rust_version: StringRust compiler version string (e.g. "rustc 1.91.0 ...").
is_release: booltrue when version is not "dev" and does not contain "dirty".
Implementations§
Source§impl VersionInfo
impl VersionInfo
Sourcepub fn package_version(&self) -> &str
pub fn package_version(&self) -> &str
Return the package version without build metadata.
Sourcepub fn semver(&self) -> Option<Version>
pub fn semver(&self) -> Option<Version>
Return the package version parsed as a semantic version, if valid.
Sourcepub fn matches_requirement(&self, requirement: &str) -> Option<bool>
pub fn matches_requirement(&self, requirement: &str) -> Option<bool>
Return whether this package version matches a semantic version requirement.
Returns None if either the version or requirement string is invalid.
Sourcepub fn short_git_commit(&self) -> Option<&str>
pub fn short_git_commit(&self) -> Option<&str>
Return the short git commit hash, if available.
Sourcepub fn short_version(&self) -> String
pub fn short_version(&self) -> String
Returns a concise version string: {version}[-{short_commit}].
Sourcepub fn full_version(&self) -> String
pub fn full_version(&self) -> String
Returns a detailed version string with optional branch and build time.
Trait Implementations§
Source§impl Clone for VersionInfo
impl Clone for VersionInfo
Source§fn clone(&self) -> VersionInfo
fn clone(&self) -> VersionInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more