ddn.util.semver
Module ddn.util.semver
Provides a full-featured Semantic Versioning (SemVer) implementation according to https://semver.org/. Includes parsing, comparison, stringification, and manipulation utilities.
Types 2
classSemVerParseException : Exception
Exception thrown when a version string is invalid.
Constructors
this(string msg)structSemVer
Represents a Semantic Version according to semver.org.
Provides parsing, comparison, and stringification.
Fields
uint majoruint minoruint patchstring[] prereleasestring[] buildMethods
int compare(const SemVer other) constCompares this SemVer to another according to semver precedence rules.SemVer bumpMajor() constReturns a new SemVer with incremented major version, resetting minor and patch to 0, and clearing prerelease/build.SemVer bumpMinor() constReturns a new SemVer with incremented minor version, resetting patch to 0, and clearing prerelease/build.SemVer bumpPatch() constReturns a new SemVer with incremented patch version, clearing prerelease/build.SemVer withPrerelease(string[] ids) constReturns a new SemVer with the given prerelease identifiers.Constructors
this(uint major, uint minor, uint patch, string[] prerelease = [], string[] build = [])Constructs a SemVer from its components.Templates 1
tmplSEMVER(uint major, uint minor, uint patch = 0)
Template for encoding a semantic version as a ulong at compile-time.
The version is encoded as major * 100_000_000 + minor * 10_000 + patch, enabling simple numeric comparisons in static if statements. Minor and patch each use 4 digits (0-9999); major has no fixed limit.
Parameters
major | Major version number (0 to practical ulong limits) |
minor | Minor version number (0-9999) |
patch | Patch version number (0-9999, defaults to 0) Example: |