[][src]Macro ever::ever

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

Print the build info of your program by setting an environment variable.

  1. Call ever macro at the beginning of your program.
use ever::ever;

fn main() {
    ever!();

    println!("Hello, world!");
}
  1. Set the environment variable VERSION to 1 and run the program. The build info gets printed and the program exits with status 1.
$ VERSION=1 ./your_program
your_program 0.1.0 (debug): 

    date:     Fri Mar  1 16:57:20 JST 2019
    commit:   1cf8aa07dbd2ab4478e14c47a970742040affc3d
    user:     yushi.omote
    host:     local
    builddir: /home/yushi.omote/dev/ever
    rustc:    rustc 1.34.0-nightly (146aa60f3 2019-02-18)

Options

If you want to change the environment variable name, pass your alternative as an argument.

ever!("MY_VERSION");
$ MY_VERSION=1 ./your_program

Note

The build info is retrieved only when the source file where ever macro is placed gets compiled.