pub fn tab<I, Error: ParseError<I>>(input: I) -> IResult<I, char, Error>where
I: StreamIsPartial + Stream,
<I as Stream>::Token: AsChar + Copy,
Expand description
Matches a tab character ‘\t’.
Complete version: Will return an error if there’s not enough input data.
Partial version: Will return Err(winnow::error::ErrMode::Incomplete(_))
if there’s not enough input data.
Example
fn parser(input: &str) -> IResult<&str, char> {
tab(input)
}
assert_eq!(parser("\tc"), Ok(("c", '\t')));
assert_eq!(parser("\r\nc"), Err(ErrMode::Backtrack(Error::new("\r\nc", ErrorKind::Verify))));
assert_eq!(parser(""), Err(ErrMode::Backtrack(Error::new("", ErrorKind::Token))));
assert_eq!(tab::<_, Error<_>>(Partial::new("\tc")), Ok((Partial::new("c"), '\t')));
assert_eq!(tab::<_, Error<_>>(Partial::new("\r\nc")), Err(ErrMode::Backtrack(Error::new(Partial::new("\r\nc"), ErrorKind::Verify))));
assert_eq!(tab::<_, Error<_>>(Partial::new("")), Err(ErrMode::Incomplete(Needed::new(1))));