winnow::token

Function rest_len

Source
pub fn rest_len<Input, Error>(input: &mut Input) -> Result<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) -> ModalResult<usize>

§Example

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)));