3 ms·
Maybe I should try smol instead of Tokio. I'm guessing a lot of libraries are made to fit with Tokio, but I imagine for a typical desktop app, a multi-threaded
by ReactiveJelly 3y ago
Maybe I should try smol instead of Tokio. I'm guessing a lot of libraries are made to fit with Tokio, but I imagine for a typical desktop app, a multi-threaded runtime is total overkill. Plus I could just run multiple runtimes if I want.
Like I suppose if I needed a blocking task that was also async, I could send that to a thread pool and then internally spawn a worker async runtime. It's a thinker.
- eska 3y agoNo need to switch. Just change the tokio flags
- masklinn 3y agoThat does not actually do anything. All Tokio APIs which demand Send closures on the MT runtime still do on the ST runtime, because the runtime flavour is not part of the API.
- Klonoar 3y agoOr, you know, that single threaded runtime that OP just mentioned. ;P
- swsieber 3y agoA single threaded Tokio runtime still has a separate thread pool for heavy tasks. Maybe block_on? I can't remember where I read that tho. Edit: not block_on, but spawn_blocking. See https://www.reddit.com/r/rust/comments/16ebdi1/comment/jzy7fai/ https://www.reddit.com/r/rust/comments/16ebdi1/comment/jzy7f...