Crate version_number

source ·
Expand description



A crate to represent and parse two- and three-component version numbers of the form major.minor, and major.minor.patch respectively. These version numbers are often seen within the Rust project manifests.

Semver compatibility

The version numbers accepted by this crate are a subset of semver version numbers, with the exception of also allowing two component (shorthand) major.minor versions.

For example, 1.0 and 1.0.0 are both accepted by this library, while the former is rejected by semver.

In addition Version does not accept extra labels such as build parameters, which are an extension of the semver version number itself.

In this crate, we call a two component major.minor version number a BaseVersion, and we call a three component major.minor.patch version number a FullVersion.



  • This crate contains multiple parsers.



  • Top level errors for version-numbers.
  • Type used to indicate which variant of a Version is used. The options are Base for Version::Base, and Full for Version::Full.
  • A numbered version which is a two-component major.minor version number, or a three-component major.minor.patch version number.