-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why do the fs and stream tokio readers not return tokio::read::ZipEntryReader #89
Comments
I would appreciate the consolication of the two. base::ZipFileReader::new() could accept a custom, (sealed) Trait, which will be implemented for Tokio-AsyncRead and Futures-AsyncRead (plus their seek-impl). When enabling the tokio-feature, base::ZipFileReader::new() would simply accept e.g. tokio::fs::File as well and could be used everywhere. |
You can't hae multiple blanket implementations (based on external traits) though. I don't think this is possible. |
The trait mustn't have a blanked implementation. But you're right, the two Generic-Implementations for tokio::AsyncRead and futures::AsyncRead could overlap and therefore conflict... Is this what you meant? Maybe a 'ZipFileReader::new_tokio' would be a better choice |
My only problem with having a That's why my current start on converting them over use types that shadow the base implementation but wrapping |
@mineichen I saw a notification about your suggestion to provide type aliases which I quite like. Unsure if there was a specific reason for your deletion but from just playing around with it myself with I've written up a short explainer: https://github.com/Majored/rs-async-zip/blob/main/src/tokio/mod.rs#L4-L18 I'm happy to settle on this unless anyone else has any suggestions. |
Makes sense, except the naming might be a bit confusing? I'd expect a |
They do take the reader as a single argument but I assume you're mentioning this since the module documentation links are slightly confusing? Not sure there's anything we can do about that. Maybe omitting the parentheses helps but to me, it just looks a bit aesthetically odd without them. |
Sorry for the confusion. I wasn't sure if I misinterpreted your post and just suggesting what you meant already... |
Why is it that only the
tokio::read::seek
module has aZipFileReader
that returnstokio::read::ZipEntryReader
s? That means that one has to wrap the entry reader(s) intokio_util::compat::Compat
to use them in a tokio context.The text was updated successfully, but these errors were encountered: