Comment by m11a

Comment by m11a a day ago

1 reply

Yes, but async Rust is basically built on tokio's runtime, which is what most the big async libraries depend on, like hyper/axum/tokio etc. And tokio is a thread-per-core work-stealing architecture, which requires Send + Sync bounds everywhere. You can avoid them if you depend on tokio-proper, but it's more icky when building on something like axum, where your application handlers also require these bounds.

A good article on this: https://emschwartz.me/async-rust-can-be-a-pleasure-to-work-w...

tcfhgj 19 hours ago

Iirc I had a situation a while back, in which I used async await with tokio with a non Send or Sync type and it compiled when I didn't use spawn[1] (implying multithreading) but a simple loop with sequential processing.

Only when I wanted to enable parallelism using spawn, I got a compilation error.

[1]: https://docs.rs/tokio/latest/tokio/task/fn.spawn.html