rust-lang / flate2-rs

DEFLATE, gzip, and zlib bindings for Rust
https://docs.rs/flate2
Apache License 2.0
891 stars 158 forks source link

Moving to futures #262

Closed jaysonsantos closed 3 years ago

jaysonsantos commented 3 years ago

Hey there, first thanks for this project :). I am using flate2 in a small pet project that is simple sync code and I am converting it to async and saw that flate2 only supports an old tokio version. I was thinking about the effort to move flate2 to futures (to avoid being bound to runtimes) and maybe try to do it by myself. Do you have anything in mind? Is it really worth it to do this move? I was thinking of tackling first zio.rs with some feature gates but many of the functions that have logic are tightly coupled to io functions. Do you see any way of tackling this? What about calling the IO functions using a macro that checks if async feature is enabled to then append a .await on the function? If you have other ideas on how to deal with this just share them.

alexcrichton commented 3 years ago

Sorry I don't know the best way to support this. My best guess though would be an external crate like tokio-flate2 or something like that which uses the lower-level types to build async versions of streams.

jaysonsantos commented 3 years ago

Hey there, do you mean another implementation of flate2 or a wrapper to be async?

alexcrichton commented 3 years ago

Most likely a crate which implements the analagous streams flate2 offers, but async versions against tokio

jaysonsantos commented 3 years ago

Hey there, I will close this as async-compression seems to do exactly that, thanks for the comment!