version_macro 0.1.0

rust cargo build binary with git version and build time
Documentation
  • Coverage
  • 0%
    0 out of 4 items documented0 out of 3 items with examples
  • Size
  • Source code size: 11.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 30.05 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ansjsun

example


#[cfg(not(debug_assertions))]
mod version {
    use version_macro::{build_git_branch, build_git_version, build_time};

    pub const BUILD_TIME: &str = build_time!();
    pub const BUILD_GIT_BRANCH: &str = build_git_branch!();
    pub const BUILD_GIT_VERSION: &str = build_git_version!();

    pub fn version() -> String {
        format!(
            "lark build info: [git_branch:{} , build_time:{} , git_version:{}]",
            BUILD_GIT_BRANCH, BUILD_TIME, BUILD_GIT_VERSION
        )
    }
}

#[cfg(debug_assertions)]
mod version {
    pub fn version() -> String {
        format!(
            "lark build info: [git_branch:{} , build_time:{} , git_version:{}]",
            "debug", "debug", "debug"
        )
    }
}