Skip to main content

Module semver

Module semver 

Source
Expand description

Minimal semver constraint matching for { registry = …, version = "…" } dependency resolution (#893).

Not a full semver implementation — no pre-release or build-metadata ordering — but enough to resolve ^, ~, exact, and comparator (>= > <= <) constraints against a set of published MAJOR.MINOR.PATCH release versions. Resolution is deterministic: best_match always returns the highest satisfying version, so a lex.lock pins a reproducible choice.

Caret/tilde follow Cargo’s rules (the left-most non-zero component is the “fixed” one for ^; ~ fixes down to the last given component).

Functions§

best_match
The highest of versions that satisfies constraint, or None if none do. Deterministic — the resolver records this exact version in the lock file.
parse_exact
Parse a full MAJOR.MINOR.PATCH (a leading v allowed). Exactly three components, unlike [parse_partial].
satisfies
Does version (a MAJOR.MINOR.PATCH string) satisfy constraint? An unparseable version never matches; an unparseable constraint matches nothing (the caller should surface “cannot resolve” rather than guess).

Type Aliases§

Version
A (major, minor, patch) version.