Skip to main content

Module version_req

Module version_req 

Source
Expand description

Lenient SemVer version-requirement parsing.

semver::VersionReq only accepts comma-separated comparator lists. Cabin manifests and index entries follow the npm-flavored form where space and comma are both accepted, so the two crates that read SemVer requirements from disk (cabin-manifest and cabin-index) used to carry an identical normalization routine. They now both consume this shared helper.

Functions§

caret_upper_bound
The exclusive upper bound of a caret (^) requirement, given a fully specified (major, minor, patch): bump the leftmost non-zero segment and zero out everything to its right, per the Cargo/npm caret rule.
parse_lenient
Parse raw as a SemVer requirement, accepting either comma- or space-separated comparator lists. Bare operators (>= 1.2) are rejoined with their version. Returns the original parse error when the input cannot be coerced into either form so callers’ diagnostics keep pointing at the user’s text.