Function nom::character::streaming::char[][src]

pub fn char<I, Error: ParseError<I>>(
    c: char
) -> impl Fn(I) -> IResult<I, char, Error> where
    I: Slice<RangeFrom<usize>> + InputIter,
    <I as InputIter>::Item: AsChar

Recognizes one character.

streaming version: Will return Err(nom::Err::Incomplete(_)) if there’s not enough input data.

Example

assert_eq!(char::<_, (_, ErrorKind)>('a')(&b"abc"[..]), Ok((&b"bc"[..], 'a')));
assert_eq!(char::<_, (_, ErrorKind)>('a')(&b"bc"[..]), Err(Err::Error((&b"bc"[..], ErrorKind::Char))));
assert_eq!(char::<_, (_, ErrorKind)>('a')(&b""[..]), Err(Err::Incomplete(Needed::Size(1))));