1 //! A Rust library to easily compare version numbers in any format,
2 //! and test them against various comparison operators.
3 //!
4 //! Comparing version numbers is hard. Especially when version numbers get really complex,
5 //! or when their formatting differs.
6 //!
7 //! This library helps you to easily compare any kind of version number with minimal code.
8 //! Two version numbers can be compared to each other, to get a relevant comparison operator (<, ==, >),
9 //! or version numbers can be tested against any given comparison operator.
10 //!
11 //! Along with version comparison, the library also features other useful tools.
12 //! For example: version numbers can be parsed to inspect a version number by it's bare numeric or text based parts.
13 //!
14 //! Inspired by PHPs [version_compare()](http://php.net/manual/en/function.version-compare.php).
15 //!
16 //! ### Version formats
17 //! A list of version number examples that are parsed successfully:
18 //!
19 //! - `1`
20 //! - `3.10.4.1`
21 //! - `1.2.alpha`
22 //! - `1.2.dev.4`
23 //! - ` ` _(empty)_
24 //! - ` .   -32 . 1` _(undefined formats)_
25 //! - `MyApp 3.2.0 / build 0932` _(complex formats, not fully functional yet)_
26 //! - _Many more and support for custom formats to come..._
27 //!
28 //! ### Semver
29 //! Version number formats like [_semver_](http://semver.org/) try to make version numbers consistent and manageable,
30 //! there are too many projects however that don't follow such format.
31 //!
32 //! Version-compare makes working with them easy and supports semver formats out of the box with zero configuration.
33 //!
34 //! ## Features
35 //! * Compare two version numbers, get: `<`, `==` or `>`.
36 //! * Compare two version numbers against any comparison operator, get `true` or `false`.
37 //! * Parse complex version numbers.
38 //! * Static, single-statement methods available.
39 //!
40 //! The following features will be added in a later version:
41 //!
42 //! * Support for text parts in version strings.
43 //! * Version manifest, to specify detailed version number constraints.
44 //! * Version ranges, and tests against them.
45 //! * Support for operators in version strings, [npm-style](https://docs.npmjs.com/misc/semver), and tests against them.
46 //! * Batch comparisons.
47 //!
48 //! ## Examples
49 //! Check out the [examples](https://github.com/timvisee/version-compare/tree/master/examples) directory for all available examples.
50 //!
51 //!
52 //! _[View complete README](https://github.com/timvisee/version-compare/blob/master/README.md)_
53 
54 pub mod comp_op;
55 pub mod version;
56 pub mod version_compare;
57 pub mod version_manifest;
58 pub mod version_part;
59 
60 #[cfg(test)]
61 mod test;
62 
63 // Reexports
64 pub use crate::comp_op::CompOp;
65 pub use crate::version::Version;
66 pub use crate::version_compare::VersionCompare;
67 pub use crate::version_manifest::VersionManifest;
68 pub use crate::version_part::VersionPart;
69