Skip to main content

parse_interval

Function parse_interval 

Source
pub fn parse_interval(s: &str, style: BracketStyle) -> Option<VersionRange>
Expand description

Parses one bracketed interval under the given BracketStyle.

Returns None for anything that isn’t a well-formed [/(/]]/)/[ interval: unbalanced delimiters, a single character that cannot serve as both delimiters, empty bounds on both sides, a stray bracket character nested inside the bounds (e.g. [[1.0,2.0), [1.0,2.0)]), a third comma-separated component ([1.0,2.0,3.0]), or a no-comma body whose delimiters aren’t the matching inclusive pair [...] ([1.0), (1.0] — neither grammar has a reversed-bracket exact-pin form). Callers treat an unparseable interval as satisfying nothing rather than panicking.