It was a special-case type that was only used in one spot, and thus not really that interesting to have in a shared place.
Unified · Split
| @@ -2,23 +2,6 @@ use std::{io, io::BufRead}; · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | use flate2::{Decompress, FlushDecompress, Status}; |
| 4 | 4 | |
| 5 | −/// The boxed variant is faster for what we do (moving the decompressor in and out a lot) | |
| 6 | −pub struct ReadBoxed<R> { | |
| 7 | − /// The reader from which bytes should be decompressed. | |
| 8 | − pub inner: R, | |
| 9 | − /// The decompressor doing all the work. | |
| 10 | − pub decompressor: Box<Decompress>, | |
| 11 | −} | |
| 12 | − | |
| 13 | −impl<R> io::Read for ReadBoxed<R> | |
| 14 | −where | |
| 15 | − R: BufRead, | |
| 16 | −{ | |
| 17 | − fn read(&mut self, into: &mut [u8]) -> io::Result<usize> { | |
| 18 | − read(&mut self.inner, &mut self.decompressor, into) | |
| 19 | − } | |
| 20 | −} | |
| 21 | − | |
| 22 | 5 | /// Read bytes from `rd` and decompress them using `state` into a pre-allocated fitting buffer `dst`, returning the amount of bytes written. |
| 23 | 6 | pub fn read(rd: &mut impl BufRead, state: &mut Decompress, mut dst: &mut [u8]) -> io::Result<usize> { |
| 24 | 7 | let mut total_written = 0; |