Async programming crates

Hello all,

Could you please recommend crates to look at if I wanna investigate async task pools? I'm a bit lost:

  • coroutine: full-fledged coroutines, with context switch
  • context: seems to be a tiny subset of coroutine
  • syncbox: looks like some std::sync primitives along with threadpool
  • eventual: seems to provide async primitive definitions, like future/promise
  • mio: async IO, its purpose is pretty much clear
  • mioco: seems to be yet another coroutine, based on both context and mio, with context switching
    ...

To me it looks like people mostly investigate in this direction, and there seems to be no concentrated effort

Thanks

1 Like

You're looking for something like AsyncTask  |  Android Developers ?

I also don't understand what do you mean by "concentrated effort". Different people have different requirements, and ideas, and I don't think there's one fit-all solution.

1 Like

I was looking for some solution which provides more or less unified interface to async tasks. Either IO or simple function invocation. The best solution so far I figured is some composition of mio for IO, eventual for futures and coroutine for coroutines as futures backend. And in fact I might've wanted to hear others stories on how they did it. By saying "lost a bit" I meant that there are multiple crates with crossing capabilities, with no obvious way to choose one over another. So my question might look silly/murky.

Unified with what exactly? As usually in engineering there are multiple way to solve a problem, and there are not clear winners.

Tell us your requirements and some details, and we can think what would be a good fit for you.

A complication with async I/O is that you cannot easily mix different event loops within one thread, so the entire async stack running in a thread has to be based on one library that dispatches events. So there's going to be pressure towards vertical async "ecosystems". Maybe there will be an eventual winner that satisfies most needs.

My question now really looks stupid to me. Like I asked "I wanna do something cool! I dunno what! Help me!". Or maybe I just wanted some generic conversation.

As of async I/O and tasks, they're relatively composable as long as you have I/O event loop on dedicated thread and some separate task pool, so that I/O events are converted into tasks and then executed on a general basis.