Function nom::character::complete::tab

source ·
pub fn tab<I, Error: ParseError<I>>(input: I) -> IResult<I, char, Error>where
    I: Slice<RangeFrom<usize>> + InputIter,
    <I as InputIter>::Item: AsChar,
Expand description

Matches a tab character ‘\t’.

Complete version: Will return an error 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(Err::Error(Error::new("\r\nc", ErrorKind::Char))));
assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Char))));