@@ -7,7 +7,7 @@ use std::{
77 io:: { self , Read } ,
88} ;
99use strum:: { Display , EnumIter , EnumString , FromRepr } ;
10- use tokio:: io:: { AsyncRead , AsyncWrite } ;
10+ use tokio:: io:: { AsyncBufRead , AsyncRead , AsyncWrite } ;
1111
1212pub type CompressionAlgorithms = HashSet < CompressionAlgorithm > ;
1313
@@ -129,19 +129,19 @@ where
129129/// You provide an AsyncRead that gives us the compressed data. With the
130130/// wrapper we return you can then read decompressed data from the wrapper.
131131pub fn wrap_reader_for_decompression < ' a > (
132- input : impl AsyncRead + Unpin + Send + ' a ,
132+ input : impl AsyncBufRead + Unpin + Send + ' a ,
133133 algorithm : CompressionAlgorithm ,
134- ) -> Box < dyn AsyncRead + Unpin + Send + ' a > {
134+ ) -> Box < dyn AsyncBufRead + Unpin + Send + ' a > {
135135 use async_compression:: tokio:: bufread;
136136 use tokio:: io;
137137
138138 match algorithm {
139139 CompressionAlgorithm :: Zstd => {
140- Box :: new ( bufread :: ZstdDecoder :: new ( io :: BufReader :: new ( input) ) )
140+ Box :: new ( io :: BufReader :: new ( bufread :: ZstdDecoder :: new ( input) ) )
141141 }
142- CompressionAlgorithm :: Bzip2 => Box :: new ( bufread :: BzDecoder :: new ( io :: BufReader :: new ( input) ) ) ,
142+ CompressionAlgorithm :: Bzip2 => Box :: new ( io :: BufReader :: new ( bufread :: BzDecoder :: new ( input) ) ) ,
143143 CompressionAlgorithm :: Gzip => {
144- Box :: new ( bufread :: GzipDecoder :: new ( io :: BufReader :: new ( input) ) )
144+ Box :: new ( io :: BufReader :: new ( bufread :: GzipDecoder :: new ( input) ) )
145145 }
146146 }
147147}
0 commit comments