#version #compare #semantic

versions

A library for parsing and comparing software version numbers

4 stable releases

new 2.0.1 Nov 19, 2020
2.0.0 Oct 22, 2020
1.0.1 Jun 15, 2020
1.0.0 Jun 3, 2020

#180 in Parser implementations

Download history 169/week @ 2020-08-06 250/week @ 2020-08-13 23/week @ 2020-08-20 18/week @ 2020-08-27 62/week @ 2020-09-03 19/week @ 2020-09-10 46/week @ 2020-09-17 10/week @ 2020-09-24 29/week @ 2020-10-01 54/week @ 2020-10-08 53/week @ 2020-10-15 35/week @ 2020-10-22 26/week @ 2020-10-29 23/week @ 2020-11-05 16/week @ 2020-11-12 40/week @ 2020-11-19

139 downloads per month
Used in 2 crates

MIT license

47KB
888 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!

Dependencies

~2MB
~35K SLoC