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

now_or_never name and documentation is misleading and ambiguous respectively #2871

Open
dspyz-matician opened this issue Jul 16, 2024 · 0 comments

Comments

@dspyz-matician
Copy link

dspyz-matician commented Jul 16, 2024

IIUC, when used with a mutable reference to a future (&mut Fut), now_or_never effectively polls Fut (similar to the poll! macro but without needing an async context). In the event of a None, the future is still guaranteed to eventually complete if awaited on or if it's a tokio join handle or something (assuming it's not otherwise aborted and doesn't run forever), so there's no sense in which not completing now means it will "never" complete.

This is sometimes extremely useful (arguably moreso than calling it on a future by value) and there doesn't seem to be any other safe method which provides the same functionality, but the naming is pretty misleading and the docs don't clarify this behavior at all.

@dspyz-matician dspyz-matician changed the title now_or_never name and documentation is ambiguous and misleading now_or_never name and documentation is misleading and ambiguous respectively Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant