3 ms·
When you want to do long-running blocking work (either computation, or synchronous IO from some library that doesn't use futures), you usually want to farm that
by oconnor663 7y ago
When you want to do long-running blocking work (either computation, or synchronous IO from some library that doesn't use futures), you usually want to farm that work out to a thread pool. I think Tokio provides convenience functions for doing that.
It's also possible to write a long-running computation as a future, which can yield after some smaller amount of work to let some IO get done. But I'm not sure if that's the recommended approach.