Function nom8::bytes::any

source ·
pub fn any<I, E: ParseError<I>, const STREAMING: bool>(
    input: I
) -> IResult<I, <I as InputIter>::Item, E>where
    I: InputIter + InputLength + Slice<RangeFrom<usize>> + InputIsStreaming<STREAMING>,
Expand description

Matches one token

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

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

Example

fn parser(input: &str) -> IResult<&str, char> {
    any(input)
}

assert_eq!(parser("abc"), Ok(("bc",'a')));
assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Eof))));
assert_eq!(any::<_, (_, ErrorKind), true>(Streaming("abc")), Ok((Streaming("bc"),'a')));
assert_eq!(any::<_, (_, ErrorKind), true>(Streaming("")), Err(Err::Incomplete(Needed::new(1))));