pub fn 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>,
Expand description
Recognizes an end of line (both ‘\n’ and ‘\r\n’).
Streaming version: Will return Err(nom::Err::Incomplete(_))
if there’s not enough input data.
Example
assert_eq!(line_ending::<_, (_, ErrorKind)>("\r\nc"), Ok(("c", "\r\n")));
assert_eq!(line_ending::<_, (_, ErrorKind)>("ab\r\nc"), Err(Err::Error(("ab\r\nc", ErrorKind::CrLf))));
assert_eq!(line_ending::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1))));