3 ms·
> Futures provide pretty much everything that Context does, but without having to thread a magical value correctly through everything. It has downsides though:
by clktmr 6y ago
> Futures provide pretty much everything that Context does, but without having to thread a magical value correctly through everything.
It has downsides though:
* Instead you have to use async/await throughout your code and suddenly have two execution models that you need to reason about
* Dropping the future won't help if the call is hanging on a blocking call either
* The callee doesn't know anything about a possible deadline
* You can only handle the cancellation in the callee in `Drop`, which gets complicated quickly if you need to rollback changes, because you need to track state manually
* After all the use of 'context' is optional. You only need to pass it if you need cancellation, whereas in async Rust you always need to keep in mind that you might get canceled.