Function nom::character::complete::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.

complete version: Will return an error if there’s not enough input data.

Example

assert_eq!(char::<_, (&str, ErrorKind)>('a')("abc"), Ok(("bc", 'a')));
assert_eq!(char::<_, (&str, ErrorKind)>('a')("bc"), Err(Err::Error(("bc", ErrorKind::Char))));
assert_eq!(char::<_, (&str, ErrorKind)>('a')(""), Err(Err::Error(("", ErrorKind::Char))));