Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for poll_ready #72992

Closed
2 of 3 tasks
djc opened this issue Jun 4, 2020 · 1 comment
Closed
2 of 3 tasks

Tracking Issue for poll_ready #72992

djc opened this issue Jun 4, 2020 · 1 comment
Labels
A-async-await Area: Async & Await C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@djc
Copy link
Contributor

djc commented Jun 4, 2020

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.

@djc djc added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Jun 4, 2020
@jonas-schievink jonas-schievink added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jun 4, 2020
@KodrAus KodrAus added the A-async-await Area: Async & Await label Jul 29, 2020
@KodrAus
Copy link
Contributor

KodrAus commented Jul 29, 2020

The PR that implemented this feature has been closed (just from inactivity). Since there isn't a feature to track here I'll go ahead and close this issue, but if there's a follow-up to #72994 that comes back then let's re-open this!

@KodrAus KodrAus closed this as completed Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants