Crates.io | pkg-version |
lib.rs | pkg-version |
version | 1.0.0 |
source | src |
created_at | 2019-05-03 14:13:32.547666 |
updated_at | 2019-11-22 20:45:26.529036 |
description | Macros expanding to the package version |
homepage | |
repository | https://github.com/jonas-schievink/pkg-version.git |
max_upload_size | |
id | 131751 |
size | 9,327 |
pkg-version
- Macros for accessing your crate versionThis 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
:
[dependencies]
pkg-version = "1.0.0"
Check the API Documentation for how to use the crate's functionality.