#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

#1407 in Procedural macros

Download history 3/week @ 2024-07-18 10/week @ 2024-07-25 5/week @ 2024-08-15 62/week @ 2024-08-22 47/week @ 2024-08-29 3/week @ 2024-09-05

114 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

~230–670KB
~16K SLoC