Skip to content

Tracking Issue for poll_ready #72992

@djc

Description

@djc

This is a tracking issue for Poll::ready() (PR #72994).
The feature gate for the issue is #![feature(poll_ready)].

Steps

Rationale: I have this code in Quinn:

.filter_map(|(i, x)| match Pin::new(x.as_mut().unwrap()).poll(cx) {
    Poll::Ready(y) => {
        *x = None;
        Some((i, y))
    }
    Poll::Pending => None,
})

And this would seem quite a bit nicer:

.filter_map(|(i, x)| {
    Pin::new(x.as_mut().unwrap()).poll(cx).ready().map(|y| {
        *x = None;
        (i, y)
    })
})

One potential downside is that this adds one more ready() after futures::ready!() and futures::future::ready(). As it is a method (compared to a free function or a macro), it seems it's still clearly distinct, but could be confusing. It otherwise seems to be the idiomatic naming choice though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions