Function combine::combinator::none_of [] [src]

pub fn none_of<T, I>(tokens: T) -> NoneOf<T, I> where
    T: Clone + IntoIterator,
    I: Stream,
    I::Item: PartialEq<T::Item>, 

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.parse(State::new(&b"xyb"[..]))
    .map(|(output, input)| (output, input.input));
assert_eq!(result, Ok((b"xy"[..].to_owned(), &b"b"[..])));

let result = parser.parse(State::new(&b"ab"[..]));
assert_eq!(result, Err(ParseError {
    position: BytePosition { position: 0 },
    errors: vec![
        Error::Unexpected(Info::Token(b'a')),
    ]
}));