Function winnow::character::complete::not_line_ending
source · pub fn not_line_ending<T, E: ParseError<T>>(
input: T
) -> IResult<T, <T as Stream>::Slice, E>where
T: Stream + AsBStr + Compare<&'static str>,
<T as Stream>::Token: AsChar,👎Deprecated since 0.1.0: Replaced with <code>winnow::character::not_line_ending</code>
Expand description
Recognizes a string of any char except ‘\r\n’ or ‘\n’.
Complete version: Will return an error if there’s not enough input data.
Example
fn parser(input: &str) -> IResult<&str, &str> {
not_line_ending(input)
}
assert_eq!(parser("ab\r\nc"), Ok(("\r\nc", "ab")));
assert_eq!(parser("ab\nc"), Ok(("\nc", "ab")));
assert_eq!(parser("abc"), Ok(("", "abc")));
assert_eq!(parser(""), Ok(("", "")));
assert_eq!(parser("a\rb\nc"), Err(ErrMode::Backtrack(Error { input: "a\rb\nc", kind: ErrorKind::Tag })));
assert_eq!(parser("a\rbc"), Err(ErrMode::Backtrack(Error { input: "a\rbc", kind: ErrorKind::Tag })));WARNING: Deprecated, replaced with winnow::character::not_line_ending