3 releases (1 stable)

1.0.0 Nov 22, 2019
0.1.2 Oct 5, 2019
0.1.1 Sep 4, 2019
0.1.0 May 3, 2019

#87 in Build Utils

Download history 450/week @ 2022-03-11 340/week @ 2022-03-18 643/week @ 2022-03-25 559/week @ 2022-04-01 838/week @ 2022-04-08 967/week @ 2022-04-15 746/week @ 2022-04-22 608/week @ 2022-04-29 1936/week @ 2022-05-06 1300/week @ 2022-05-13 1552/week @ 2022-05-20 950/week @ 2022-05-27 1411/week @ 2022-06-03 693/week @ 2022-06-10 808/week @ 2022-06-17 851/week @ 2022-06-24

3,917 downloads per month
Used in 9 crates (8 directly)

0BSD license

6KB

pkg-version - Macros for accessing your crate version

crates.io docs.rs Build Status

This crate provides macros (pkg_version_major!, etc.) that expand to the Cargo package version, as an integer literal.

Previously, the only way to access the package version was by using env!("CARGO_PKG_VERSION_MAJOR") etc., but doing that always results in a string literal, which can only be parsed into a number at runtime. This crate fixes that problem by parsing the version during macro expansion.

Please refer to the changelog to see what changed in the last releases.

Usage

Add an entry to your Cargo.toml:

[dependencies]
pkg-version = "1.0.0"

Check the API Documentation for how to use the crate's functionality.

Dependencies