Skip to content

Tracking Issue for future::lazy #91647

New issue

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

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

Already on GitHub? # to your account

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: 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

@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: 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. labels Dec 8, 2021
@ibraheemdev
Copy link
Member Author

Closing per #91648 (comment).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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

1 participant