pub fn recognize<Input, P>(parser: P) -> Recognize<Input, P> where
    <Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
    Input: Stream,
    P: Parser<Input>,
    Input: RangeStream,
    <Input as StreamOnce>::Range: Range
Expand description

Zero-copy parser which returns committed input range.

combinator::recognize is a non-RangeStream alternative.

let mut parser = recognize(skip_many1(letter()));
assert_eq!(parser.parse("hello world"), Ok(("hello", " world")));
assert!(parser.parse("!").is_err());