1 stable release
1.0.0 | Mar 11, 2023 |
---|
#115 in #semver
12KB
289 lines
yad_semver (Yet Another Damn Semver)
This crate provides a simple SemVer 2.0 implementation.
SemVer structs can be converted to/from strings, and can be compared.
This crate exists because the "semver" crate is "for Cargo's flavor of Semantic Versioning", whereas this crate structly follows the semver 2.0 specification.
Usage
use yad_semver::SemVer;
// You can create SemVer structs in place
let v1 = SemVer::new(1, 0, 0, None, None);
// Or from strings
let v2 = "2.0.0-alpha".parse::<SemVer>().unwrap();
// SemVers can be compared and displayed
use std::cmp::max;
println!("The newest version is {}", max(v1, v2));
lib.rs
:
yad_semver (Yet Another Damn Semver)
This crate provides a simple SemVer 2.0 implementation.
SemVer structs can be converted to/from strings, and can be compared.
This crate exists because the "semver" crate is "for Cargo's flavor of Semantic Versioning", whereas this crate structly follows the semver 2.0 specification.
Usage
use yad_semver::SemVer;
// You can create SemVer structs in place
let v1 = SemVer::new(1, 0, 0, None, None);
// Or from strings
let v2 = "2.0.0-alpha".parse::<SemVer>().unwrap();
// SemVers can be compared and displayed
use std::cmp::max;
println!("The newest version is {}", max(v1, v2));
Dependencies
~2.1–3MB
~54K SLoC