simple-version
A small Rust library that provides a Version<T> type for handling semantic versioning,
including an optional build number. It also offers a version_from_pkg! macro to embed
the crate's compile-time CARGO_PKG_VERSION directly into your code.
Examples
1. create a new Version object
(without a build number)
use Version;
let v = new;
println!; // 1.2.3
2. create a new Version object
(with a build number)
use Version;
let v = new.build;
println!; // 1.2.3+4
3. create a new Version object
(using the Cargo package version)
# Cargo.toml
[]
= "..."
= "1.2.3"
...
use ;
let v: = version_from_pkg!;
println!; // 1.2.3
4. Compare between two versions
use Version;
let v1 = new;
let v2 = new;
assert!;
5. Compare between two versions
(with exceptions)
use Version;
let v1 = new.build; // v1 has a build number.
let v2 = new; // v2 does not.
assert!; // In this case, v1 is greater.