4 ms·
> Just because async is in the language, don't feel like you need to use it everywhere. Except that you will have to because no alternative library exist
by noncoml 6y ago
> Just because async is in the language, don't feel like you need to use it everywhere.
Except that you will have to because no alternative library exist
- cjg 6y agoIt'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.
- zokier 6y agoYou know you can just write your own code and not just glue libraries together? In general I find Rust less dependant on libraries because pretty much all the basic building blocks are exposed and available. You can pretty much just start doing syscalls directly if needed
- carols10cents 6y agoWhat libraries are you trying to use for what tasks that you can only find async libraries?