Crate const_pkg_version

Source
Expand description

Constant expressions for your package version.

§Example

use const_pkg_version::Version;
const VERSION_FULL: Version = const_pkg_version::version!();

const VERSION_MAJOR: u32 = const_pkg_version::major!();
const VERSION_MINOR: u32 = const_pkg_version::minor!();
const VERSION_PATCH: u32 = const_pkg_version::patch!();
const VERSION_PRE: Option<&str> = const_pkg_version::pre_release!();
const BUILD_METADATA: Option<&str> = const_pkg_version::build_metadata!();

§Features

  • debug: Implements Debug for Version (enabled by default).
  • defmt: Implements [defmt::Format] for Version.
  • serde: Implements [serde::Deserialize] and [serde::Serialize] for Version.
  • semver: Implements TryFrom<crate::Version> for [semver::Version].

Macros§

build_metadata
Get the build metadata of your package in a constant expression.
major
Get the major version of your package in a constant expression.
minor
Get the minor version of your package in a constant expression.
patch
Get the patch version of your package in a constant expression.
pre_release
Get the pre-release version of your package in a constant expression.
version
Get the full version information of your package in a constant expression.

Structs§

Version
A full package version (major, minor, patch, pre-release and build-metadata).