Description
Maybe this is just a misunderstanding of what poll_flush
actually means, but from the documentation I would expect poll_flush
of the Sink
trait to only return Poll::Ready
once all buffered messages have been received by the Receiver
of the channel, meaning the buffer is empty.
futures-rs/futures-sink/src/lib.rs
Lines 93 to 95 in 939614b
Currently the Sink
implementation for Sender
and UnboundedSender
don't do that though, making poll_flush
almost equivalent to poll_ready
. See:
futures-rs/futures-channel/src/mpsc/sink_impl.rs
Lines 17 to 25 in 939614b
In the Unbounded case, it doesn't flush anything at all:
futures-rs/futures-channel/src/mpsc/sink_impl.rs
Lines 44 to 46 in 939614b
Is this intentional? And if so, how does this relate to the documentation of the Sink
trait? Maybe the documentation can be updated to clarify this?