flate2-rs icon indicating copy to clipboard operation
flate2-rs copied to clipboard

total_in(&self) / total_out(&self) implementation for GzDecoder / GzEncoder / MultiGzDecoder

Open fedy-cz opened this issue 2 years ago • 2 comments
trafficstars

Hello

Is there a reason why total_in(&self) / total_out(&self) isn't implemented for Gzip decoders/encoders? It is present for both Zlib and Deflate and could be really useful for monitoring progress of the operation.

Looking at the decoder implementations, they seem to be using the same DeflateDecoder underneath - only wrapped in CrcReader<>. So it could be as simple as forwarding the function call in.

It could be also nice to separate these functions into a trait to provide a generic interface for libraries building on top of flate2.

fedy-cz avatar Oct 15 '23 12:10 fedy-cz

Thanks for bringing this up!

Even though I don't have an answer, I wonder if that could be an oversight that could be remedied by adding these methods and wiring them up? Could that work as 'as simple as possible' solution? And possible, do we have tests that could be extended to use that new functionality?

Byron avatar Oct 15 '23 14:10 Byron

Submited PR for this: https://github.com/rust-lang/flate2-rs/pull/382

fedy-cz avatar Oct 15 '23 14:10 fedy-cz