async-rs / async-rs/async-attributes

Feature idea: support multiple executors

Open
#21 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
49
Forks
12
PR merge metrics
No merged PRs in 30d

Description

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`](https://github.com/paulkernfeld/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(future: F) -> T where F: Future`

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the crate code that calls `async_std::task::block_on` and read how its futures reach that call. Compare the two proposed approaches—supporting several executors or accepting a user-supplied executor function—and determine the API and compatibility requirements. Done means the executor choice is pluggable for the stated use cases, including `spin_on`, with appropriate coverage for the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.