Skip to main content

Module vers

Module vers 

Source
Expand description

vers version ranges (the version-range notation CLE and PURL use), parsed in full and evaluated for SemVer and PyPI versions.

Experimental: may change in a 0.x minor release.

VersRange::parse checks the syntax of any vers:<type>/<constraints> string. VersRange::contains_semver then evaluates it when its type compares versions as SemVer 2.0 (VersRange::is_semver_type): semver, and npm, whose registered vers type uses node-semver versions. VersRange::contains_pypi evaluates the pypi type with PEP 440 ordering (crate::pep440). Every other type is reported as unsupported, never guessed.

The rules are from the vers specification, release v1.2.1 of https://github.com/package-url/vers-spec (docs/specification/): constraints are sorted by version, each version occurs once, * stands alone, and outside != the comparators alternate between lower and upper bounds. A range that breaks these rules is an error, not corrected.

Structs§

Constraint
One constraint: a comparator and a percent-decoded version.
VersRange
A parsed vers range.

Enums§

Comparator
The comparator of one constraint.
VersError
Why a string is not a valid vers range, or could not be evaluated.

Constants§

MAX_VERS_BYTES
Inputs longer than this are rejected with VersError::TooLong.