pub fn anychar<T, E>(input: T) -> Result<(T, char), Err<E>>where
E: ParseError<T>,
T: InputIter + InputLength + Slice<RangeFrom<usize>>,
<T as InputIter>::Item: AsChar,
Available on crate feature
mtls
only.Expand description
Matches one byte as a character. Note that the input type will
accept a str
, but not a &[u8]
, unlike many other nom parsers.
Complete version: Will return an error if there’s not enough input data.
§Example
fn parser(input: &str) -> IResult<&str, char> {
anychar(input)
}
assert_eq!(parser("abc"), Ok(("bc",'a')));
assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Eof))));