devela::_dep::winnow::token

Function rest_len

pub fn rest_len<Input, Error>(
    input: &mut Input,
) -> Result<usize, ErrMode<Error>> 
where Input: Stream, Error: ParserError<Input>,
Available on crate feature dep_winnow only.
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::token::rest_len;
assert_eq!(rest_len::<_,InputError<_>>.parse_peek("abc"), Ok(("abc", 3)));
assert_eq!(rest_len::<_,InputError<_>>.parse_peek(""), Ok(("", 0)));