Crate vergen [] [src]

Defines the vergen function.

vergen when used in conjunction with the build script support from cargo, generates a file in OUT_DIR (defined by cargo) with three functions defined (now, sha, and semver). This file can then be use with include! to pull the functions into your source for use.

Example Cargo.toml

[package]
build = "build.rs"

[build-dependencies]
vergen = "*"

Example build.rs

// build.rs
extern crate vergen;

use vergen::vergen;

fn main() {
    vergen();
}

Example Usage

extern crate vergen;

include!(concat!(env!("OUT_DIR"), "/version.rs"));

fn main() {
    version();
}

// Example version function
fn version() -> String {
   format!("{} {} blah {}", now(), sha(), semver())
}

Structs

OutputFns

Output Functions Bitflags

VergenError

An error generated by the vergen function.

Constants

COMMIT_DATE

Generate the commit_date fn.

NOW

Generate the now fn.

SEMVER

Generate the semver fn.

SHA

Generate the sha fn.

SHORT_NOW

Generate the short_now fn.

SHORT_SHA

Generate the short_sha fn.

TARGET

Generate the target fn.

Functions

vergen

Create the version.rs file in OUT_DIR, and write three functions into it.