Expand description
NuGet version comparison, prerelease detection, and range/floating syntax.
§Why this is hand-rolled
No maintained Rust crate implements NuGet’s versioning scheme. NuGet versions are
Major.Minor.Patch[.Revision] (1–4 numeric components, Major required) with SemVer2
prerelease precedence and case-insensitive prerelease label comparison; the workspace’s
semver crate rejects both 1.2.3.4 (too many components) and 1.2 (too few) outright, so
it cannot parse the common NuGet forms. deps-maven set the precedent for a crate-local
hand-rolled comparator under the same constraint (no maintained crate for Maven’s scheme).
Functions§
- compare_
versions - Compares two NuGet version strings.
- is_
prerelease - Detects whether a NuGet version string is a prerelease version.
- resolve_
float - Resolves a floating-version pattern (
*,1.1.*,*-*,1.2.0-rc.*, …) against a list of available versions, returning the highest matching version. - satisfies
- Checks whether
versionsatisfies a NuGet interval-notationrange(spec §2).