4 ms·
Calling a sync function from an async when using the tokio executor is literally documented as a thing you should not do. Furthermore if you want to then spawn
by stevemk14ebr 6y ago
Calling a sync function from an async when using the tokio executor is literally documented as a thing you should not do. Furthermore if you want to then spawn a task or whatever it's called, which is the documented way to do this safely, then you have to capture with static lifetime. That is a hard guarantee to provide for sufficiently complex code! Rust is definitely colored, and it's not as simple as just spawning an executor
- stuhood 6y agoTo spawn a sync function from an async context you use https://docs.rs/tokio/1.3.0/tokio/task/fn.spawn_blocking.html https://docs.rs/tokio/1.3.0/tokio/task/fn.spawn_blocking.htm....