Are both doing the same? If yes, which one should be preferred?
tokio::task module contains utilities for spawning tasks on the Tokio runtime.
futures::task is not really comparable to
tokio::task. It is better to compare it to
std::task, which mainly contains utilities for building wakers useful when manually implement the
Future trait on your own types. It also has a
Spawn trait, which I have never seen used.
You should use
tokio::task if you want to spawn tasks on the Tokio runtime. You should use
std::task) if you are manually implementing
Future (or e.g.
Stream) and need special wakers.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.