Expand description
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");
Macros§
- env_
version - Macro that parses a
semver::Version
from an environment variable and outputs it as a constant expression. - version
- Macro that parses a
semver::Version
from string and outputs it as a constant expression.