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: introduce I/O utility helpers #1203

Closed
9 tasks done
carllerche opened this issue Jun 26, 2019 · 5 comments · Fixed by #1377
Closed
9 tasks done

tokio: introduce I/O utility helpers #1203

carllerche opened this issue Jun 26, 2019 · 5 comments · Fixed by #1377
Milestone

Comments

@carllerche
Copy link
Member

carllerche commented Jun 26, 2019

The existing I/O utility helpers were deleted in #1164. New ones should be implemented.

The utility helpers will be implemented on AsyncReadExt and AsyncWriteExt traits and will exist in tokio::io.

Some helpers to add include, but are not limited to:

AsyncReadExt

  • read
  • read_to_end
  • read_to_string
  • read_exact
  • read_until
  • copy

AsyncWriteExt

  • write
  • write_all
  • flush
@bIgBV
Copy link
Contributor

bIgBV commented Jun 27, 2019

I'm working on porting over read_until but it depends on the std::io::BufRead trait and the now deprecated try_nb! macro from tokio-io. I'm not sure how the BufRead bound will work with the new syntax.

One option is to copy over the functionality of read_until from BufRead into this future. This would mean adding a dependency on memchr though, as it looks like the standard library ships with its own version of the same.

@bIgBV
Copy link
Contributor

bIgBV commented Jun 30, 2019

Looks like read_to_end also depended on behavior from the Read trait and will have to be re-thought as well.

@taiki-e
Copy link
Member

taiki-e commented Jul 15, 2019

I think it is good to define the AsyncBufRead trait and experiment with it, like futures-io.

EDIT: Opened #1301

@mokomull
Copy link

mokomull commented Aug 2, 2019

Does AsyncRead::split() belong on this list as well? It seems to have been replaced with a TCP-only implementation, but I was using it with UnixStream.

I am currently using futures 0.3's AsyncReadExt::split instead, via @Nemo157's shim from #1297, and it works beautifully.

@carllerche
Copy link
Member Author

@mokomull added a line item to #1256.

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

Successfully merging a pull request may close this issue.

4 participants