Open
Description
Problem:
None of our poll_*
functions actually take a cx: &mut std::task::Context
, which is the standardized interface for futures in Rust. Instead, applications are expected to call conn.set_waker(cx.waker())
before calling poll_*
.
Solution:
We should, instead, double down on async, and require std::task::Context
to be passed to all functions that have the signature fn poll_*(&mut self, cx: &mut std::task::Context) -> Poll<Result<_>>;
. For blocking IO applications, it's very trivial to make no-op wakers, especially with the coming Waker::noop
method in std
(see rust-lang/rust#98286). We can also add blocking APIs that construct noop wakers, if this is too painful as well.