[][src]Macro git_version::git_version

macro_rules! git_version {
    #[proc_macro_hack] => { ... };

Get the git version for the source code.

The following (named) arguments can be given:

  • args: The arguments to call git describe with. Default: args = ["--always", "--dirty=-modified"]

  • prefix, suffix: The git version will be prefixed/suffexed by these strings.

  • cargo_prefix, cargo_suffix: If either is given, Cargo's version (given by the CARGO_PKG_VERSION environment variable) will be used if git fails instead of giving an error. It will be prefixed/suffixed by the given strings.

  • fallback: If all else fails, this string will be given instead of reporting an error.


This example is not tested
const VERSION: &str = git_version!();
This example is not tested
const VERSION: &str = git_version!(args = ["--abbrev=40", "-always"]);
const VERSION: &str = git_version!(prefix = "git:", cargo_prefix = "cargo:", fallback = "unknown");