Expand description

A library for parsing and comparing software version numbers.

We like to give version numbers to our software in a myriad of different ways. Some ways follow strict guidelines for incrementing and comparison. Some follow conventional wisdom and are generally self-consistent. Some are just plain asinine. This library provides a means of parsing and comparing any style of versioning, be it a nice Semantic Version like this:


…or a monstrosity like this:



If you’re parsing several version numbers that don’t follow a single scheme (say, as in system packages), then use the Versioning type and its parser Versioning::new. Otherwise, each main type - SemVer, Version, or Mess - can be parsed on their own via the new method (e.g. SemVer::new).


use versions::Versioning;

let good = Versioning::new("1.6.0").unwrap();
let evil = Versioning::new("1.6.0a+2014+m872b87e73dfb-1").unwrap();

assert!(good.is_ideal());   // It parsed as a `SemVer`.
assert!(evil.is_complex()); // It parsed as a `Mess`.
assert!(good > evil);       // We can compare them anyway!

Usage with nom

In constructing your own nom parsers, you can integrate the parsers used for the types in this crate via SemVer::parse, Version::parse, and Mess::parse.


You can enable Serde support for serialization and deserialization with the serde feature.


Chunks that have a comparison behaviour specific to Version.

A complex version number with no specific structure.

Chunks that have comparison behaviour according to SemVer’s rules for prereleases.

An ideal version number that conforms to Semantic Versioning.

A version number with decent structure and comparison logic.


A logical unit of a version number.

Possible values of a section of a Mess.

Symbols that separate groups of digits/letters in a version number. Used in the Mess.

A top-level Versioning type which acts as a wrapper for the more specific types.