pub fn utf8_scalar(range: RangeInclusive<u32>) -> Utf8Scalar
Expand description
Returns a parser that recognizes the first unicode scalar value in a string slice if its value is in the specified range
The range must be bounded on both ends. Only inclusive ranges are allowed.
use parser_compose::{Parser, utf8_scalar};
let msg = "a1";
let alphabetic = utf8_scalar(97..=122);
let (value, rest) = alphabetic.try_parse(msg).unwrap();
assert_eq!(value, "a");
assert_eq!(rest, "1");
let result = alphabetic.try_parse(rest);
assert!(result.is_none());