Function combine::parser::token::none_of [−][src]
pub fn none_of<T, Input>(tokens: T) -> NoneOf<T, Input> where
T: Clone + IntoIterator,
Input: Stream,
Input::Token: PartialEq<T::Item>,
Expand description
Extract one token and succeeds if it is not part of tokens
.
let mut parser = many1(none_of(b"abc".iter().cloned())); let result = parser.easy_parse(position::Stream::new(&b"xyb"[..])) .map(|(output, input)| (output, input.input)); assert_eq!(result, Ok((b"xy"[..].to_owned(), &b"b"[..]))); let result = parser.easy_parse(position::Stream::new(&b"ab"[..])); assert_eq!(result, Err(easy::Errors { position: 0, errors: vec![ easy::Error::Unexpected(easy::Info::Token(b'a')), ] }));