Skip to content
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

Using the flate2 crate with only AsyncRead/AsyncWrite #268

Closed
TheNeikos opened this issue Apr 18, 2021 · 3 comments
Closed

Using the flate2 crate with only AsyncRead/AsyncWrite #268

TheNeikos opened this issue Apr 18, 2021 · 3 comments

Comments

@TheNeikos
Copy link

Hello! I'm trying to use a tcp OwnedWriteHalf from tokio with flate2, but am unable to do so as it does not implement Write and instead only implements AsyncWrite.

Is there a way for me to still use this library? Since GzEncoder etc... all require Write but also implement AsyncWrite when the wrapped T does, it feels like that the Write bound is too restrictive.

Simple playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b0c9dd53d0735d38f24e076a1469c9e0

@TheNeikos TheNeikos changed the title Using the flate2 with only AsyncRead/AsyncWrite Using the flate2 crate with only AsyncRead/AsyncWrite Apr 18, 2021
@gkelly
Copy link

gkelly commented Jul 29, 2021

I think this comes from using the older AsyncRead/AsyncWrite definitions from tokio-io. In that crate they were extensions of Read/Write. But in more recent tokio they are not.

As @TheNeikos points out, this comes from the R: Read bound when using most of the ::new fns. This was always true in the past because of AsyncRead being historically Read.

@TheNeikos
Copy link
Author

Ah, indeed in 2.0 it seems that the Write bound has been removed. Well, once it is updated to that, I can integrate this crate then 👍

@gkelly
Copy link

gkelly commented Jul 30, 2021

It looks like the plan might be to drop tokio support from this crate and have people depend on the async_compression crate for that instead: #214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants