#version #compare #semantic

versions

A library for parsing and comparing software version numbers

12 stable releases (3 major)

4.1.0 Apr 21, 2022
4.0.0 Jan 8, 2022
3.0.3 Aug 23, 2021
3.0.2 May 28, 2021
1.0.1 Jun 15, 2020

#110 in Parser implementations

Download history 3291/week @ 2022-10-19 1862/week @ 2022-10-26 3137/week @ 2022-11-02 2431/week @ 2022-11-09 3998/week @ 2022-11-16 2566/week @ 2022-11-23 3644/week @ 2022-11-30 3202/week @ 2022-12-07 5135/week @ 2022-12-14 2776/week @ 2022-12-21 2045/week @ 2022-12-28 3309/week @ 2023-01-04 2868/week @ 2023-01-11 2986/week @ 2023-01-18 4440/week @ 2023-01-25 3114/week @ 2023-02-01

14,305 downloads per month
Used in 15 crates (10 directly)

MIT license

55KB
1K SLoC

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
~27K SLoC