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

tokio-0.2.0-alpha4 AsyncRead and AsyncWrite traits are not the same as futures-0.3.0-alpha18 versions. #1551

Closed
farnz opened this issue Sep 13, 2019 · 6 comments

Comments

@farnz
Copy link
Contributor

farnz commented Sep 13, 2019

tokio-0.2's AsyncWrite, AsyncRead etc are out of sync with the futures-0.3 versions - e.g. tokio's AsyncWrite is implemented for Vec<u8>, while futures' AsyncWrite is implemented for Cursor<T> where T: AsMut<[u8]>.

Rather than supplying its own versions of these traits, could tokio reuse the futures versions?

@Nemo157
Copy link
Contributor

Nemo157 commented Sep 13, 2019

See also #1297

@carllerche
Copy link
Member

Currently, the primary difference between the two traits is Tokio's reliance on Buf and BufMut. Adding these to futures-io has been proposed here, but not accepted.

There are probably other issues that I would like to see addressed w/ the current traits (both futures-io and tokio), but on a personal note, I am punting on that until I am able to update Tokio to the latest mio & bytes crates.

@theduke
Copy link
Contributor

theduke commented Nov 6, 2019

So with futures 0.3 out, what is the path forward here?

The _buf methods were not adopted, yet it would be really quite unfortunate if tokio continued to use different traits.

@jebrosen
Copy link
Contributor

jebrosen commented Nov 7, 2019

An idea that I think others have mentioned, but not posted here, would be for tokio to implement futures_io::AsyncRead for each type that also implements tokio::io::AsyncRead, under an optional dependency. This probably can't be done with a blanket impl, but a macro could be doable.

See also tokio-rs/tokio-compat#2 (adding I/O to tokio-compat)

@theduke
Copy link
Contributor

theduke commented Nov 7, 2019

Linking #1744 for reference.

@tamird
Copy link

tamird commented May 20, 2020

#1744 is now closed; @carllerche where should people be following along on efforts (if any) to converge Async{Read,Write} with those of futures?

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

7 participants