3 ms·
It's easy to convert an async function into a blocking one. For example, you could use https://docs.rs/async-std/1.9.0/async_std/task/fn.block_on.html https://d
by cjg 6y ago
It's easy to convert an async function into a blocking one. For example, you could use https://docs.rs/async-std/1.9.0/async_std/task/fn.block_on.html https://docs.rs/async-std/1.9.0/async_std/task/fn.block_on.h...
So just use the async functions from the library synchronously if you want.
- heavenlyblue 6y agoBut you can't really do vice-versa.
- cjg 6y agoWell, you can use https://docs.rs/async-std/1.9.0/async_std/task/fn.spawn_blocking.html https://docs.rs/async-std/1.9.0/async_std/task/fn.spawn_bloc... But this is partly the reason why libraries might be more inclined to support async rather than blocking calls.