#semver #version

macro semver-macro

A proc-macro for semver::Version

1 unstable release

0.1.0 Jul 10, 2024

#2913 in Parser implementations

MIT license

5KB

semver-macro

crates.io Documentation MIT License

This crate contains macros to parse semver::Versions 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::Versions 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
~18K SLoC