History

change!: remove `zlib::stream::inflate::ReadBoxed`.

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.

Sebastian Thiel committed 3 years ago

Commit 032cea31 parent 9fbed4b1 file · +0 −17Browse files

Unified · Split

gix-features/src/zlib/stream/inflate.rs+0−17
@@ -2,23 +2,6 @@ use std::{io, io::BufRead}; · 1 unmodified line
2 2
3use flate2::{Decompress, FlushDecompress, Status};3use flate2::{Decompress, FlushDecompress, Status};
4 4
5/// The boxed variant is faster for what we do (moving the decompressor in and out a lot)
6pub 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
13impl<R> io::Read for ReadBoxed<R>
14where
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/// Read bytes from `rd` and decompress them using `state` into a pre-allocated fitting buffer `dst`, returning the amount of bytes written.5/// Read bytes from `rd` and decompress them using `state` into a pre-allocated fitting buffer `dst`, returning the amount of bytes written.
23pub fn read(rd: &mut impl BufRead, state: &mut Decompress, mut dst: &mut [u8]) -> io::Result<usize> {6pub fn read(rd: &mut impl BufRead, state: &mut Decompress, mut dst: &mut [u8]) -> io::Result<usize> {
24 let mut total_written = 0;7 let mut total_written = 0;