winnow::combinator

Function rest_len

Source
pub fn rest_len<Input, Error>(input: &mut Input) -> PResult<usize, Error>
where Input: Stream, Error: ParserError<Input>,
Expand description

Return the length of the remaining input.

Note: this does not advance the Stream

§Effective Signature

Assuming you are parsing a &str Stream:

pub fn rest_len(input: &mut &str) -> PResult<usize>

§Example

use winnow::combinator::rest_len;
assert_eq!(rest_len::<_,InputError<_>>.parse_peek("abc"), Ok(("abc", 3)));
assert_eq!(rest_len::<_,InputError<_>>.parse_peek(""), Ok(("", 0)));