-
Notifications
You must be signed in to change notification settings - Fork 632
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
Add a helper for always ready futures #2825
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
taiki-e
reviewed
Feb 26, 2024
Hey, @taiki-e, just letting you know I responded to your review comment. |
taiki-e
reviewed
Mar 8, 2024
I think adding this statement to the document would be helpful. |
taiki-e
approved these changes
Mar 9, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
taiki-e
added
A-future
Area: futures::future
0.3-backport: pending
The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet.
labels
Mar 9, 2024
taiki-e
pushed a commit
that referenced
this pull request
Oct 5, 2024
Merged
taiki-e
pushed a commit
that referenced
this pull request
Oct 5, 2024
taiki-e
added
0.3-backport: completed
and removed
0.3-backport: pending
The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet.
labels
Oct 5, 2024
taiki-e
pushed a commit
that referenced
this pull request
Oct 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, there is no easy way to wrap a given value in a zst future, so this PR adds one. The
always_ready
function has to take a closure to allow it to yield non-zsts without having to carry around it's size.This is particularly useful in avoiding a heap allocation when a library needs
Pin<Box<dyn Future<Output<T>>>
, as a simple empty async block still has to allocate a boolean in this example for "has been polled".