[−][src]Function gchemol_parser::parsers::one_of
pub fn one_of<I, T, Error>(list: T) -> impl Fn(I) where
Error: ParseError<I>,
I: Slice<RangeFrom<usize>> + InputIter,
T: FindToken<<I as InputIter>::Item>,
<I as InputIter>::Item: AsChar,
<I as InputIter>::Item: Copy,
Recognizes one of the provided characters.
complete version: Will return an error if there's not enough input data.
Example
assert_eq!(one_of::<_, _, (&str, ErrorKind)>("abc")("b"), Ok(("", 'b'))); assert_eq!(one_of::<_, _, (&str, ErrorKind)>("a")("bc"), Err(Err::Error(("bc", ErrorKind::OneOf)))); assert_eq!(one_of::<_, _, (&str, ErrorKind)>("a")(""), Err(Err::Error(("", ErrorKind::OneOf))));