diff options
Diffstat (limited to 'src/reader.rs')
-rw-r--r-- | src/reader.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/reader.rs b/src/reader.rs index 3d963f1..478af36 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -37,7 +37,11 @@ impl<T: futures_lite::io::AsyncRead + std::marker::Unpin + Send> Reader<T> { if bytes == 0 { return Err(crate::Error::EOF); } - self.parser.add_bytes(&self.buf[..bytes]); + self.parser.add_bytes( + // read() returning a value means that that many bytes are + // guaranteed to be available + self.buf.get(..bytes).unwrap_or_else(|| unreachable!()), + ); } } |