Expand description

Flex Version

Crates.io Crates.io License Contributors

A crate for flexible version numbers, mostly inspired by Ruby’s Gem::Version. This crate provides a flexible versioning structure which is compatible with Semantic Versioning, and some other obscure versioning schemas used in the wild.

Syntax

Versions are defined as components separated by dots, minus or plus signs. Each component might be either a number, or an alphabetic string.

Version stringCanonical representation
00
0.90.9
0.9a0.9.a
0.9.a0.9.a
1.01.0
1.0.5.4-b.31.0.5.4.b.3

Ordering

Versions have a total order, which is mainly determined by the order of numeric components. Alphabetic components are inferior to all numeric components, and lexicographic between themselves. When comparing Versions, missing trailing components are treated as zero.

Example

The following versions are ordered from lower to higher. Equal versions are presented in the same line.

  1. 0.9
  2. 1.0.a.2
  3. 1.0.b1
  4. 1.0, 1, 1.0.0.0
  5. 1.0.1

Structs

An error while parsing a version.

A version. Versions are composed of one or more components, and provide a total ordering.

Enums

A component is a indivisible part of a version. May be a number, or a alphabetic identifier.

Constants

The characters that are hard delimiters for components. This constant is public more as a matter of documentation than of utility.