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 = semver.parse("1.2.3-beta.1");
println(v.major());
if v.matches(">=1.0.0") {
println("compatible");
}
}
try_parseParse a semantic version string.
Returns Err(string) if the string is not a valid semantic version.
parseParse a semantic version string.
Panics if the string is not a valid semantic version.
Use try_parse for a structured Result<Version, string> failure surface.
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.
No-op for compatibility (struct versions don't need manual freeing).