Function utils::parser::number_range

source ·
pub fn number_range<I: Integer + Parseable>(
    range: RangeInclusive<I>,
) -> NumberRange<I>
Expand description

Parser for numbers in the supplied range.

The type of the number to parse is inferred from the range’s type.

See also byte_range.

§Examples

assert_eq!(
    parser::number_range(100u8..=125u8).parse(b"123, 120"),
    Ok((123u8, &b", 120"[..]))
);