Function winnow::bytes::streaming::is_not

source ·
pub fn is_not<T, I, Error: ParseError<I>>(
    arr: T
) -> impl Fn(I) -> IResult<I, <I as Stream>::Slice, Error>where
    I: Stream,
    T: ContainsToken<<I as Stream>::Token>,
👎Deprecated since 0.1.0: Replaced with <code>winnow::bytes::take_till1</code> with input wrapped in <code>winnow::Partial</code>
Expand description

Parse till certain characters are met.

The parser will return the longest slice till one of the characters of the combinator’s argument are met.

It doesn’t consume the matched character.

It will return a ErrMode::Incomplete(Needed::new(1)) if the pattern wasn’t met.

Example

use winnow::bytes::streaming::is_not;

fn not_space(s: &str) -> IResult<&str, &str> {
  is_not(" \t\r\n")(s)
}

assert_eq!(not_space("Hello, World!"), Ok((" World!", "Hello,")));
assert_eq!(not_space("Sometimes\t"), Ok(("\t", "Sometimes")));
assert_eq!(not_space("Nospace"), Err(ErrMode::Incomplete(Needed::new(1))));
assert_eq!(not_space(""), Err(ErrMode::Incomplete(Needed::new(1))));

WARNING: Deprecated, replaced with winnow::bytes::take_till1 with input wrapped in winnow::Partial