Use actix_web::rt::spawn()
, which does not have a Send
requirement, and runs the future on the current thread:
https://docs.rs/actix-web/latest/actix_web/rt/fn.spawn.html
Any other Send
futures or tasks can be spawned into different threads, and any other non-Send (!Send
) futures can be spawned on the same thread, they will cooperate to share execution time.
If you need a dedicated thread for a !Send
future, you can create it manually using std::thread::Builder
, then use Handle::block_on()
to call actix_web::rt::spawn()
to run the future locally on that thread.
Here is a similar answer that covers most of that: