Macro nom::char [] [src]

macro_rules! char {
    ($i:expr, $c: expr) => { ... };
}

matches one character: `char!(char) => &[u8] -> IResult<&[u8], char>

Example

named!(match_letter_a<char>, char!('a'));
assert_eq!(match_letter_a(b"abc"), Ok((&b"bc"[..],'a')));

assert_eq!(match_letter_a(b"123cdef"), Err(Err::Error(error_position!(&b"123cdef"[..], ErrorKind::Char))));