Function rest_len

fn rest_len<Input, Error>(input: &mut Input) -> Result<usize, Error>
where
    Input: Stream,
    Error: ParserError<Input>

Return the length of the remaining input.

Note: this does not advance the Stream

Effective Signature

Assuming you are parsing a &str [Stream]:

# use winnow::prelude::*;;
pub fn rest_len(input: &mut &str) -> ModalResult<usize>
# {
#     winnow::token::rest_len.parse_next(input)
# }

Example

# use winnow::prelude::*;
# use winnow::error::ContextError;
use winnow::token::rest_len;
assert_eq!(rest_len::<_,ContextError>.parse_peek("abc"), Ok(("abc", 3)));
assert_eq!(rest_len::<_,ContextError>.parse_peek(""), Ok(("", 0)));