#version #compare #semantic

versions

A library for parsing and comparing software version numbers

10 stable releases

3.0.3 Aug 23, 2021
3.0.2 May 28, 2021
3.0.0 Apr 16, 2021
2.1.0 Mar 22, 2021
1.0.1 Jun 15, 2020

#41 in Parser implementations

Download history 1797/week @ 2021-07-01 2127/week @ 2021-07-08 1490/week @ 2021-07-15 876/week @ 2021-07-22 2726/week @ 2021-07-29 1665/week @ 2021-08-05 2978/week @ 2021-08-12 2077/week @ 2021-08-19 2398/week @ 2021-08-26 1607/week @ 2021-09-02 1929/week @ 2021-09-09 1594/week @ 2021-09-16 1357/week @ 2021-09-23 1320/week @ 2021-09-30 1205/week @ 2021-10-07 1383/week @ 2021-10-14

8,060 downloads per month
Used in 4 crates

MIT license

52KB
968 lines

Versions

Tests

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:

1.2.3-r1

...or a monstrosity like this:

2:10.2+0.0093r3+1-1

For the Haskell version of this library, see here.

Examples

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!

Features

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

Dependencies

~1.5MB
~29K SLoC