Skip to content

bindings: double down on Wakers #4807

Open
@camshaft

Description

@camshaft

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions