Skip to content

Tracking Issue for future::lazy #91647

Closed
Closed
@ibraheemdev

Description

@ibraheemdev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions