#semver #version #proc-macro

macro current_semver

Get the current semver type from the environment

1 unstable release

0.1.1 Oct 2, 2023
0.1.0 Oct 2, 2023

#1315 in Procedural macros

50 downloads per month

MIT/Apache

7KB
72 lines

current_semver!

This will parse the current version of your crate and create the semver::Version struct.

Usage

pub fn main() {
    /// Make sure to include the semver crate
    let version: semver::Version = current_semver!();
}

Example output

pub fn main() {
    let version = semver::Version { major: 1, minor: 1, patch: 0, pre: semver::Prerelease::new("BETA").unwrap_or_default(), build: semver::BuildMetadata::default() };
}

Dependencies

~215–650KB
~16K SLoC