@std/data/semver.ms#
Import each required symbol with import Name from "@std/data/semver.ms".
Version Type#
A parsed semantic version as defined by Semantic Versioning 2.0.0.
type Version {
major Int
minor Int
patch Int
prerelease List[String] = []
build List[String] = []
}Version.build#
Dot-separated build metadata identifiers in input order; ignored by compare.
build List[String] = []Version.major#
Major version number; incremented for incompatible changes.
major IntVersion.minor#
Minor version number; incremented for compatible additions.
minor IntVersion.patch#
Patch version number; incremented for compatible fixes.
patch IntVersion.prerelease#
Dot-separated pre-release identifiers in input order; empty for a release version.
prerelease List[String] = []Version.compare#
Compares two versions by SemVer precedence, returning -1, 0 or 1. Build metadata is
ignored, and a pre-release sorts before its release (1.0.0-rc.1 before 1.0.0).
fn compare(other Version) IntVersion.to_string#
Formats a version as major.minor.patch[-prerelease][+build].
fn to_string() Stringparse Function#
Parses strict Semantic Versioning 2.0.0 text. A leading v or surrounding space is
rejected with kind EBADMSG, like any other malformed text. A numeric part too large
for Int returns kind ERANGE.
fn parse(text String) Result[Version, Error] { ... }