Similar to https://github.com/rust-lang-nursery/futures-rs/issues/1512, we've been missing an async equivalent of std's io::BufReader and io::BufWriter. This would be useful to reduce the amount of system calls, and speed up throughput.
I've experimented with this in embrio with trait AsyncBufRead, an async struct BufReader and an implementation of async fn read_until (the latter can definitely be simplified by providing async fn fill_buf() on top of fn poll_fill_buf() and actually using async fn syntax). These have definitely worked well, and it should be straightforward to port std-like variants into futures (these were a little different than the ones provided in std since embrio is alloc-less).
std::io::BufWriter implements Drop, and it is convenient. Do you think that async BufWriter can also implement it? (functions that call flush_buf (flushes the internal buffer) internally need to receive a context. into_inner also has the same problem.)
IMO anyone using an async writer should be calling close on it to ensure it's fully flushed and closed, dropping a writer without closing it is allowed to just abandon any outstanding writes (which is something that probably needs documenting on AsyncWrite). Having std::io::Write implementations set the precedent that dropping will flush outstanding writes and swallow errors is quite unfortunate though.
Most helpful comment
IMO anyone using an async writer should be calling
closeon it to ensure it's fully flushed and closed, dropping a writer without closing it is allowed to just abandon any outstanding writes (which is something that probably needs documenting onAsyncWrite). Havingstd::io::Writeimplementations set the precedent that dropping will flush outstanding writes and swallow errors is quite unfortunate though.