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 future::lazy #91647

Closed
3 tasks
ibraheemdev opened this issue Dec 8, 2021 · 1 comment
Closed
3 tasks

Tracking Issue for future::lazy #91647

ibraheemdev opened this issue Dec 8, 2021 · 1 comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@ibraheemdev
Copy link
Member

ibraheemdev commented Dec 8, 2021

Feature gate: #![feature(future_lazy)]

This is a tracking issue for core::future::{lazy, Lazy}, which executes a closure the first time it is polled:

let a = std::future::lazy(|_| 1);
assert_eq!(a.await, 1);

Public API

// core::future

pub struct Lazy<F> {
    f: Option<F>,
}

pub fn lazy<F, R>(f: F) -> Lazy<F>
where
    F: FnOnce(&mut Context<'_>) -> R,
{
    // ..
}

impl<F, R> Future for Lazy<F>
where
    F: FnOnce(&mut Context<'_>) -> R,
{
    type Output = R;

    // ...
}

Steps / History

Unresolved Questions

  • None yet.
@ibraheemdev ibraheemdev added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Dec 8, 2021
@ibraheemdev
Copy link
Member Author

Closing per #91648 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. 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

1 participant