jonhoo / async-bincode

Asynchronous access to a bincode-encoded item stream.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using the `Sink` for writing in async?

swwu opened this issue · comments

I noticed this library exposes the futures_sink::Sink trait instead of the futures::sink::Sink trait. Unlike the latter, the former seems to not support futures::sink::SinkExt, which provides actual async methods for dumping things in, and there doesn't seem to be an equivalent convenience trait.

Is there currently a supported way to write to these in async contexts, by awaiting on some future, without directly interacting with the poll_ interface (and therefore having to manually manage polling/wakeups)?

futures::Sink is a re-export of futures_sink::Sink, so they are exactly the same :)

https://github.com/rust-lang/futures-rs/blob/89c06f5e89b8499102a198736ccc859949e049a3/futures/src/lib.rs#L115

As a result, both also support SinkExt.