async-attributes icon indicating copy to clipboard operation
async-attributes copied to clipboard

Feature idea: support multiple executors

Open paulkernfeld opened this issue 4 years ago • 0 comments

Right now, it looks like this will always execute using async_std::task::block_on. I bet that will work great for most scenarios, and if that's intended to be the full scope of this crate, that makes sense! 😊

My feature idea is: for use cases that demand extremely small code size, fast compile time, deployment on an exotic platform, the ability to use multiple threads, or maybe just to support someone's preference for a certain executor, what do you think of making the executor pluggable? To be up front, I'm interested in using this with spin_on because I have some non-performance intensive code and I'm looking for really fast compile times.

I can think of two variations of this:

  1. Explicitly support several useful executors
  2. Allow the user to specify their own executor function with a signature similar to fn block_on<F, T>(future: F) -> T where F: Future<Output = T>

I'm pretty sure that this is feasible and I'd be happy to fill in some technical details if this sounds like a desirable feature.

paulkernfeld avatar Jan 13 '21 22:01 paulkernfeld