1 unstable release
0.1.0 | Jul 10, 2024 |
---|
#2813 in Parser implementations
5KB
semver-macro
This crate contains macros to parse semver::Version
s at compile-time.
Currently only versions without pre-release and build metadata identifier
are supported.
Example
use semver::Version;
use semver_macro::version;
const MY_VERSION: Version = version!("0.1.0");
lib.rs
:
A proc-macro for semver::Version
This crate contains macros to parse semver::Version
s at compile-time.
Currently only versions without pre-release and build metadata identifier
are supported.
Example
use semver::Version;
use semver_macro::{version, env_version};
// parse from string literal
const FROM_LITERAL: Version = version!("0.1.0");
// parse from environment variable
const FROM_ENV: Version = env_version!("CARGO_PKG_VERSION");
Dependencies
~0.4–0.8MB
~19K SLoC