std::text::semverSemantic versioning โ pure Hew implementation.
Parse, inspect, compare, and match semantic version strings according to the SemVer 2.0.0 specification.
import std.text.semver;
fn main() {
let v = match semver.parse("1.2.3-beta.1") {
.Ok(version) => version,
.Err(reason) => panic(reason),
};
println(v.major());
if v.matches(">=1.0.0") {
println("compatible");
}
}
parseParse a semantic version string.
Returns Err(string) if the string is not a valid semantic version.
VersionMethodsMethods available on a parsed Version.
Return the major version number.
Return the minor version number.
Return the patch version number.
Return the pre-release label, or an empty string if none.
Compare this version to another. Returns -1, 0, or 1.
Test whether this version satisfies a version requirement string.
Return the version as a string.