Skip to main content

rskit_version/
lib.rs

1//! Build-time version and git metadata for rskit.
2//!
3//! Version, git commit, branch,
4//! and build time are captured at compile time via a `build.rs` script that runs `git` commands
5//! and emits `cargo:rustc-env` variables. The build timestamp is captured as a Unix epoch
6//! and formatted to RFC 3339 by the library, avoiding any external `date` command.
7//!
8//! # Quick Start
9//!
10//! ```rust
11//! use rskit_version::{get_version_info, get_short_version, get_full_version, is_release};
12//!
13//! let info = get_version_info();
14//! println!("{}", info.version);      // e.g. "0.1.0-alpha.1"
15//! println!("{}", info.git_commit);   // e.g. "a1b2c3d..."
16//! println!("{}", get_short_version()); // "0.1.0-alpha.1-a1b2c3d"
17//! println!("{}", get_full_version()); // "0.1.0-alpha.1-a1b2c3d (built 2024-01-15T10:30:00Z)"
18//! ```
19
20#![warn(missing_docs)]
21
22pub mod schema;
23pub mod semver;
24
25mod info;
26
27pub use info::{
28    VersionInfo, get_full_version, get_short_version, get_version_info, is_release, package_semver,
29    package_version,
30};
31
32#[cfg(test)]
33mod tests;