async-std icon indicating copy to clipboard operation
async-std copied to clipboard

Missing async close on io::Write

Open jocutajar opened this issue 4 years ago • 3 comments

Hello,

I would like to close IO asynchronously.

Please add close to WriteExt as seen in futures: https://docs.rs/futures-lite/1.12.0/futures_lite/io/trait.AsyncWriteExt.html

jocutajar avatar Jul 02 '21 15:07 jocutajar

Are you asking for AsyncDrop?

Fishrock123 avatar Jul 02 '21 21:07 Fishrock123

I think it's just that futures_lite exposes a close function, but async-std's WriteExt does not although async-std's Write does include a poll_close. futures_lite::AsyncWriteExt should be compatible with async-std's Write, which I believe is a reexport of futures::AsyncWrite, so I think it's possible to use the AsyncWriteExt from futures-lite with async-std's Write, but I believe this issue is specifically about adding a close method to the async-std one in order to make poll_close useful

jbr avatar Jul 02 '21 21:07 jbr

@Fishrock123, no. And I imagine that would be pretty tough to do, wouldn't it?

@jbr, exactly. I could use futures, but why pull yet another dependency? I want to io.close().await?;

jocutajar avatar Jul 09 '21 15:07 jocutajar