2 ms·
Non-tokio runtimes manage just fine without all of those bounds for local, single-threaded execution though. https://docs.rs/smol/latest/smol/fn.block_on.html
by bryal 1y ago
Non-tokio runtimes manage just fine without all of those bounds for local, single-threaded execution though.
https://docs.rs/smol/latest/smol/fn.block_on.html https://docs.rs/smol/latest/smol/fn.block_on.html
- khuey 1y agoBlocking on an asynchronous task and waiting for it to finish is fundamentally a different operation than spawning an asynchronous operation and returning to the caller to execute entirely different code. smol's spawn also requires the Future to be 'static (https://docs.rs/smol/latest/smol/fn.spawn.html https://docs.rs/smol/latest/smol/fn.spawn.html), while tokio's local block_on also does not require 'static or Send + Sync (https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html#method.block_on https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html...).