Closed arifd closed 1 year ago
compat is there so that this crate can support not just tokio, but also async-std and potentially even more runtime.
This is a workaround until portable runtime is standardrised
This crate is absolutely wonderful, it saved me over a year ago when I was too dumb to figure out async_compression, and your package (back at 0.0.7) wrapped it and did all the dirty work for me.
Glad we could help. 😄
it no longer wraps async_compression. Why not?
Could you clarify what you mean exactly? I can't remember anything having drastically changed in that area.
It has introduced this Compat thing. Which I did not need before.
You can use the with_tokio() constructor to avoid having to manually call .compact(). You can find more detail about this in the module-level docs.
I was hoping you wouldn't explaining this Compat situation and why it is now needed. In the process I hope to gain a better understanding of the rust async ecosystem! Thank you!!
As alluded to above, the base implementation no longer depends on tokio in order to allow support for other runtimes. At the moment, Rust doesn't allow async functions in traits which means the standard library doesn't provide async versions of the IO traits. So these runtimes have to define their own which is where compat
comes in to convert between the different traits.
Once there are stabilised async IO traits within the standard library, I'd expect almost everyone to start depending on them and then we can switch the base implementation over (and then only have tokio
for tokio-specfic things like the fs reader).
Aha! Perfect explanation. Thank you! Makes a lot of sense.
If you look at the dependencies for 0.0.7 you'll see async_compression there
(I just assumed async_zip was a thin wrapper)
If you look at the deps for 0.0.15, async_compression has become optional
ahh.. but now I look at your feature list again, it makes sense, it was made optional so that users of async_zip can pick and choose what to compile! Which is great because it's exactly why I bumped to 0.0.15! :D ... It still essentially depends on async_compression it as much as it did.
Hi Harry!
This crate is absolutely wonderful, it saved me over a year ago when I was too dumb to figure out async_compression, and your package (back at 0.0.7) wrapped it and did all the dirty work for me.
Now I just bumped the package to 0.0.15, to take advantage of some of the compression algorithms being behind feature flags, and improve compile times, but I noticed a couple things:
Compat
thing. Which I did not need before.I was hoping you wouldn't explaining this
Compat
situation and why it is now needed. In the process I hope to gain a better understanding of the rust async ecosystem! Thank you!!For reference, here is my function that uses your library, and the comments IN CAPS detail the changes i had to make to bump to 0.0.15