You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
dspyz-matician
changed the title
now_or_never name and documentation is ambiguous and misleadingnow_or_never name and documentation is misleading and ambiguous respectively
Jul 16, 2024
IIUC, when used with a mutable reference to a future (
&mut Fut
),now_or_never
effectively pollsFut
(similar to thepoll!
macro but without needing an async context). In the event of aNone
, 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.
The text was updated successfully, but these errors were encountered: