git-const 1.1.0

Proc macro to provide properties of git repo
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented1 out of 4 items with examples
  • Size
  • Source code size: 4.38 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 259.26 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • DoumanAsh/git-const
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • DoumanAsh

Proc macro to access git repo properties at build time.

Usage

use git_const::{git_hash, git_short_hash, git_root};

const ROOT: &str = git_root!();
const SHORT_VERSION: &str = git_short_hash!();
const VERSION: &str = git_hash!();
assert_ne!(VERSION, "");
assert!(!VERSION.contains('\n'));
assert_ne!(VERSION, SHORT_VERSION);
assert!(VERSION.starts_with(SHORT_VERSION));

const MASTER_VERSION: &str = git_hash!(master);
assert_eq!(MASTER_VERSION, VERSION); //true if current branch is master
let path = std::path::Path::new(ROOT);
assert_eq!(path.file_name().unwrap().to_str().unwrap(), "git-const");