Remix.run Logo
bryal 3 days 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

khuey 2 days ago | parent [-]

Blocking 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), while tokio's local block_on also does not require 'static or Send + Sync (https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html...).