Function nom::character::complete::not_line_ending[][src]

pub fn not_line_ending<T, E: ParseError<T>>(input: T) -> IResult<T, T, E> where
    T: Slice<Range<usize>> + Slice<RangeFrom<usize>> + Slice<RangeTo<usize>>,
    T: InputIter + InputLength,
    T: Compare<&'static str>,
    <T as InputIter>::Item: AsChar,
    <T as InputIter>::Item: AsChar

Recognizes a string of any char except ‘\r’ 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("abc"), Ok(("", "abc")));
assert_eq!(parser(""), Ok(("", "")));