diff --git a/src/parse.rs b/src/parse.rs index 13c8e56..a76975a 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -389,7 +389,11 @@ where /// Consume the rest of the buffer and return it as a slice. pub fn parse_rest(&mut self) -> ParseResult> { - let mut bytes = self.data.chunk()?.to_cow(); + let mut bytes = match self.data.chunk() { + Ok(chunk) => chunk.to_cow(), + Err(e) if e.kind() == ErrorKind::Eof => return Ok(Cow::from(&[])), + Err(e) => return Err(e), + }; self.data.advance(bytes.len()); loop {