git-sha1 1.0.1

Expose the Git-SHA1 to the crate during build-time.
docs.rs failed to build git-sha1-1.0.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: git-sha1-1.1.0

Provide the current Git commit SHA1 during build.

Example

In build.rs:

use git_sha1::GitSHA1;

fn main() {
GitSHA1::read().set("GIT_SHA1");
}

In main.rs:

use git_sha1::GitSHA1;

// either as static &str:
static SHA1: &str = env!("GIT_SHA1");

// or during runtime:
fn main() {
let sha1 = GitSHA1::from_env("GIT_SHA1");

let long = sha1.long();
assert_eq!(SHA1, long);

let short = sha1.short(10);
assert_eq!(&SHA1[..10], short);
}