Skip to main content

parse_range_parts

Function parse_range_parts 

Source
pub fn parse_range_parts<T>(
    start: &str,
    end: &str,
    limits: RangeInclusive<T>,
    default_lower: T,
    default_upper: T,
) -> Result<RangeInclusive<T>>
where T: FromStr + Copy + PartialOrd + Display, <T as FromStr>::Err: Error + Sync + Send + 'static,
Expand description

Parse parts of a range from input strings.

Start and end values must be a type that is parseable from a string. Ranges are inclusive. Whitespace is trimmed from start and end values before parsing.

If start or end values are empty, the values in defaults will be used.

ยงPanics

Panics if limits has a start after its end or default_lower is greater than default_upper.