Function rocket::mtls::oid::asn1_rs::nom::bytes::complete::is_not

source ·
pub fn is_not<T, Input, Error>(arr: T) -> impl Fn(Input)
where Error: ParseError<Input>, Input: InputTakeAtPosition, T: FindToken<<Input as InputTakeAtPosition>::Item>,
Available on crate feature mtls only.
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 Err::Error(("", ErrorKind::IsNot)) if the pattern wasn’t met.

§Example

use nom::bytes::complete::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"), Ok(("", "Nospace")));
assert_eq!(not_space(""), Err(Err::Error(Error::new("", ErrorKind::IsNot))));