#cargo-version #building #return #job #who #you-re #macro

version

A very simple library who's job is to return the version of your crate if you're building with Cargo

5 stable releases

Uses old Rust 2015

3.0.0 Mar 28, 2018
2.0.1 Jan 25, 2016
1.1.0 Jan 13, 2016
1.0.0 Jan 8, 2015

#783 in Rust patterns

Download history 1083/week @ 2023-12-10 1013/week @ 2023-12-17 592/week @ 2023-12-24 778/week @ 2023-12-31 977/week @ 2024-01-07 1158/week @ 2024-01-14 1288/week @ 2024-01-21 1129/week @ 2024-01-28 1158/week @ 2024-02-04 1699/week @ 2024-02-11 1458/week @ 2024-02-18 1167/week @ 2024-02-25 1104/week @ 2024-03-03 984/week @ 2024-03-10 1314/week @ 2024-03-17 1232/week @ 2024-03-24

4,726 downloads per month
Used in 50 crates (32 directly)

MIT/Apache

7KB
58 lines

version

version is a very simple library who's job is to return the version of your crate if you're building with Cargo.

Usage:

#[macro_use]
extern crate version;

// ...

version!() // Returns something like "1.0.0"

let ver : Version = FromStr::from_str( version!() ).unwrap();

Notes:

This only works if you're building with Cargo since the macro fetches the version digits from enviroment variables set by Cargo ( CARGO_PKG_VERSION_{MAJOR, MINOR, PATCH} ).

No runtime deps