#version #package-version #details #stable #api #macro #pkg-version

macro pkg-version-impl

Implementation details of the pkg-version crate. Do not use this crate, it does not provide a stable API.

2 releases

0.1.1 Oct 5, 2019
0.1.0 May 3, 2019

#19 in #package-version

Download history 929/week @ 2024-03-14 1169/week @ 2024-03-21 1867/week @ 2024-03-28 1440/week @ 2024-04-04 1316/week @ 2024-04-11 1085/week @ 2024-04-18 1436/week @ 2024-04-25 1210/week @ 2024-05-02 1025/week @ 2024-05-09 627/week @ 2024-05-16 611/week @ 2024-05-23 948/week @ 2024-05-30 1122/week @ 2024-06-06 803/week @ 2024-06-13 762/week @ 2024-06-20 486/week @ 2024-06-27

3,386 downloads per month
Used in 27 crates (via pkg-version)

0BSD license


pkg-version - Macros for accessing your crate version

crates.io docs.rs CI

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.


Add an entry to your Cargo.toml:

pkg-version = "1.0.0"

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


Implementation details of the pkg-version crate.

Do not use this crate directly. It does not provide a stable API and might break at any time. Use pkg-version instead.