Expand description
Build-time version and git metadata for rskit.
Version, git commit, branch,
and build time are captured at compile time via a build.rs script that runs git commands
and emits cargo:rustc-env variables. The build timestamp is captured as a Unix epoch
and formatted to RFC 3339 by the library, avoiding any external date command.
§Quick Start
use rskit_version::{get_version_info, get_short_version, get_full_version, is_release};
let info = get_version_info();
println!("{}", info.version); // e.g. "0.1.0-alpha.1"
println!("{}", info.git_commit); // e.g. "a1b2c3d..."
println!("{}", get_short_version()); // "0.1.0-alpha.1-a1b2c3d"
println!("{}", get_full_version()); // "0.1.0-alpha.1-a1b2c3d (built 2024-01-15T10:30:00Z)"Modules§
Structs§
- Version
Info - Immutable snapshot of build/version metadata. Compatible with gokit and pykit
VersionInfo.
Functions§
- get_
full_ version - Returns a detailed version string with optional branch and build time.
- get_
short_ version - Returns a concise version string:
{version}[-{short_commit}]. - get_
version_ info - Returns comprehensive version information collected at compile time.
- is_
release - Returns
truewhen this build represents a release (not dev, not dirty). - package_
semver - Return the Cargo package version parsed as a semantic version, if valid.
- package_
version - Return the Cargo package version for this crate.