async-rs / async-std

Async version of the Rust standard library
https://async.rs
Apache License 2.0
3.93k stars 336 forks source link

Missing async close on io::Write #977

Open jocutajar opened 3 years ago

jocutajar commented 3 years ago

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

Fishrock123 commented 3 years ago

Are you asking for AsyncDrop?

jbr commented 3 years ago

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

jocutajar commented 3 years ago

@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?;