Rust library: version-compare
A Rust library to easily compare version numbers, and test them against various comparison operators.
Comparing version numbers is hard. Especially when version numbers get really complex, or when their formatting differs.
This library helps you to easily compare any kind of version number with a single code-statement.
Two version numbers can be compared to each other, to get a relevant comparison operator (<
, ==
, >
),
or version numbers can be tested against any given comparison operator.
Along with version comparison, the library also features other useful tools.
For example: version numbers can be parsed to inspect a version number by it's bare numeric or text based parts.
Inspired by PHPs version_compare().
Note: This library is still a work in progress. See the list below for a list of currently available and future features.
Features
- Compare two version numbers, get:
<
,==
or>
. - Compare two version numbers against any comparison operator.
- Parse complex version numbers.
- Static, single-statement methods available.
The following features will be added in a later version:
- Support for text parts in version strings.
- Version manifest, to specify detailed version number constraints.
- Batch comparisons.
Example
This library is very easy to use. Here's a basic usage example:
Cargo.toml:
[]
= "0.0.5"
extern crate version_compare;
use ;
Check out the examples directory for more complete examples.
Builds
This library is automatically build and tested for each commit using CI services.
Service | Branch | Build Status | |
---|---|---|---|
Travis CI | master | View Status | |
Travis CI | last commit | View Status |
License
This project is released under the GNU GPL-3.0 license. Check out the LICENSE file for more information.