Skip to main content

Module interval

Module interval 

Source
Expand description

Shared bracket-interval version range parsing, used by both deps-maven and deps-gradle.

Maven and Gradle both express a single version range as a bracket interval ([1.0,2.0), [1.0], [1.5,), (,2.0]). Gradle additionally accepts a reversed-bracket exclusive notation Maven does not have (]1.2,1.5] for an exclusive lower bound, [1.1,2.0[ for an exclusive upper bound) — the only grammar difference between the two, selected via BracketStyle. What differs between the ecosystems is what wraps a single interval: Maven allows a top-level comma union of intervals ((,1.0),(1.2,)), handled by deps_maven::range; Gradle has no such union and a single interval is the whole requirement, handled by deps_gradle::range. Bounds are compared with crate::version::compare_versions_for_range, which understands Maven’s qualifier precedence (alpha < beta < milestone < rc < snapshot < release < sp) — plain numeric parsing would misorder bounds like [1.0-beta,2.0-rc) — and normalizes a missing trailing segment as zero, so a bound and the version it is checked against need not share the same segment count ([1.0] matches 1.0.0).

Enums§

BracketStyle
Selects the delimiter grammar parse_interval accepts.
VersionRange
A single parsed bracket interval, e.g. [1.0,2.0) or [1.0].

Functions§

contains
Whether version falls inside the parsed interval range.
parse_interval
Parses one bracketed interval under the given BracketStyle.