-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implement core::future::lazy
#91648
Implement core::future::lazy
#91648
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
☔ The latest upstream changes (presumably #91691) made this pull request unmergeable. Please resolve the merge conflicts. |
Triage: merge conflicts |
@ibraheemdev can you please resolve the merge conflicts? |
Ping from triage: |
@ibraheemdev Mind making an ACP for this. r=me on the impl if the API gets a second. r? @thomcc |
@rustbot author |
After thinking about it, I'm not sure there's any benefit of this over an async block and something like #92116 (comment) to access the context. I'm going to close this for now. |
Lazy
executes a closure the first time it is polled:Prior art: https://docs.rs/futures/latest/futures/future/fn.lazy.html
The argument for exposing
task::Context
to the closure is thatlazy
can serve as a one-timepoll_fn
that accepts anFnOnce
, as opposed to anFnMut
. See here for details.(Would a better name be
once
?)