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
@hawkw and I were discussing a Uncancelable<F: FusedFuture> wrapper which runs a future, and spawns a task with the remaining work if the future is dropped before being completed. It is possible to write that, but it ran into several issues:
It's basically equivalent to eagerly spawning a task.
It requires the future to be Unpin, so it can be moved out of the Uncancelable future in order to spawn it as a task in the Drop impl. This implies that if the future is an async block, it would need to be eagerly boxed at construction time. So you aren't saving on allocations.
All the other typical limitations of spawning tasks apply, such that the future must be Send + 'static.
The one advantage is that it would avoid spawning a task if the wrapper is run to completion, but honestly the added complexity doesn't seem worth it.
We should document this in a "negative results" section in the cancel-safe-futures docs.
The text was updated successfully, but these errors were encountered:
@hawkw and I were discussing a
Uncancelable<F: FusedFuture>
wrapper which runs a future, and spawns a task with the remaining work if the future is dropped before being completed. It is possible to write that, but it ran into several issues:Unpin
, so it can be moved out of theUncancelable
future in order to spawn it as a task in theDrop
impl. This implies that if the future is an async block, it would need to be eagerly boxed at construction time. So you aren't saving on allocations.Send + 'static
.The one advantage is that it would avoid spawning a task if the wrapper is run to completion, but honestly the added complexity doesn't seem worth it.
We should document this in a "negative results" section in the cancel-safe-futures docs.
The text was updated successfully, but these errors were encountered: