Pluggable Async Runtime: AsyncManager Trait + spawn! Macro#839
Merged
qdot merged 10 commits intobuttplugio:devfrom Mar 16, 2026
Merged
Pluggable Async Runtime: AsyncManager Trait + spawn! Macro#839qdot merged 10 commits intobuttplugio:devfrom
qdot merged 10 commits intobuttplugio:devfrom
Conversation
…to buttplug_core::spawn
Makes it so it's possible to disable for downstream users to disable default features and not have to worry about features being re-enabled by dependencies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the work on #833, split into smaller PR as recommended. See #833 for motivation.
Replaces the compile-time cfg_if-based async runtime dispatch in buttplug_core with a dynamic, pluggable AsyncManager trait backed by a global OnceLock. This is the foundation for supporting alternative async runtimes (e.g. esp-idf-hal for embedded) without requiring upstream dependencies in buttplug_core.
I feel like a trait + global implementation is best for the library since the other alternatives i can think of are:
extern "Rust" fnAll of which have clear downsides in my opinion.
I do not think any further tests are needed for this change. Ideally wasm would be testing as part of CI, but if anything this change may make that slightly easier to implement in the future :)