Function version_compare::compare
source · Expand description
Compare two version number strings to each other.
This compares version a to version b, and returns whether version a is greater, less
or equal to version b.
If either version number string is invalid an error is returned.
One of the following operators is returned:
Cmp::EqCmp::LtCmp::Gt
Examples
use version_compare::{Cmp, compare};
assert_eq!(compare("1.2.3", "1.2.3"), Ok(Cmp::Eq));
assert_eq!(compare("1.2.3", "1.2.4"), Ok(Cmp::Lt));
assert_eq!(compare("1", "0.1"), Ok(Cmp::Gt));