Skip to content
This repository has been archived by the owner on May 6, 2018. It is now read-only.

Add AsyncBufRead #61

Closed
ishitatsuyuki opened this issue Jul 31, 2017 · 3 comments
Closed

Add AsyncBufRead #61

ishitatsuyuki opened this issue Jul 31, 2017 · 3 comments

Comments

@ishitatsuyuki
Copy link

std::io::BufRead being a trait allows zero-copy reading on already on-memory buffers. I propose here to add the similar thing in tokio-io. Adapters should also be added, either separated, or specialized (I haven't think into the detail).

One usecase of the async version is that adding additional transform on half-decoded byte buffers. In hyper, the response body is decoded into chunk, then we're going to apply gzip decoding on it (planned to be implemented in reqwest).

This should benefit tokio-tls as well.

@alexcrichton
Copy link
Contributor

I've been using AsyncRead + std::io::BufRead for this, but what would you think AsyncBufRead would do differently?

@ishitatsuyuki
Copy link
Author

Well, I still haven't found a usecase, but if there's something missing, it's the way to wait for fill_buf.

@alexcrichton
Copy link
Contributor

Ok, in that case I believe this is solved with AsyncRead + BufRead. Waiting for fill_buf to succeed is the same as waiting for read to succeed.

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

No branches or pull requests

2 participants