minimal/
minimal.rs

1//! A minimal usage example of the version-compare crate.
2//!
3//! This compares two given version number strings, and outputs which is greater.
4//!
5//! Run this example by invoking `cargo run --example minimal`.
6
7use version_compare::{compare, Cmp};
8
9fn main() {
10    let a = "1.3";
11    let b = "1.2.4";
12
13    match compare(a, b) {
14        Ok(Cmp::Lt) => println!("Version a is less than b"),
15        Ok(Cmp::Eq) => println!("Version a is equal to b"),
16        Ok(Cmp::Gt) => println!("Version a is greater than b"),
17        _ => panic!("Invalid version number"),
18    }
19}