Skip to content

Conversation

@schgoo
Copy link
Collaborator

@schgoo schgoo commented Jan 13, 2026

No description provided.

@schgoo schgoo changed the title Add wing crate with generic Spawner trait for spawn tasks for different async runtimes feat: Add wing crate with generic Spawner trait for spawn tasks for different async runtimes Jan 13, 2026
@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (241a287) to head (db0c403).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #193   +/-   ##
=======================================
  Coverage   100.0%   100.0%           
=======================================
  Files         105      108    +3     
  Lines        6767     6798   +31     
=======================================
+ Hits         6767     6798   +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martintmk
Copy link
Member

Have you thought about applying this guide to spawner?

https://microsoft.github.io/rust-guidelines/guidelines/libs/ux/index.html?highlight=trait#M-DI-HIERARCHY

The idea is that Spawner would be just a normal struct that would expose multiple constructors to create it.

For example:

Tokio:

let spawner = Spawner::new_tokio();

Custom Runtime:

let spawner = Spawner::new_custom(move |future| runtime_handle.spawn(future));

The Spawner would just accept futures of type Future<Output = ()>, but it could also expose additional methods on public APIs that would work with result-returning types. This could be archived by using some oneshot-based async channels.

The downside of this approach is that we would enforce Send and Sync bounds, but this is aligned with https://microsoft.github.io/rust-guidelines/guidelines/libs/interop/index.html?highlight=Send#M-TYPES-SEND.

@schgoo
Copy link
Collaborator Author

schgoo commented Jan 14, 2026

Have you thought about applying this guide to spawner?

https://microsoft.github.io/rust-guidelines/guidelines/libs/ux/index.html?highlight=trait#M-DI-HIERARCHY

I can see the value here. I guess the tradeoff would be some additional heap allocations and indirection internally, since the new_custom(...) closure will have to accept a boxed future. Once Oxidizer RT moves here we can add a direct enum variant for it to avoid that additional cost. In fact, we can probably remove this abstraction altogether at that point.

@martintmk
Copy link
Member

I can see the value here. I guess the tradeoff would be some additional heap allocations and indirection internally, since the new_custom(...) closure will have to accept a boxed future. Once Oxidizer RT moves here we can add a direct enum variant for it to avoid that additional cost. In fact, we can probably remove this abstraction altogether at that point.

I see the value of this type even when oxidizer rt is public. Sometimes, the library only needs to care about how to spawn tasks and using this type can simplify those scenarios.

Copy link
Collaborator

@ralfbiedert ralfbiedert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing

@schgoo schgoo changed the title feat: Add arty crate with generic Spawner trait for spawn tasks for different async runtimes feat: Add anyspawn crate with generic Spawner trait for spawn tasks for different async runtimes Jan 22, 2026
@schgoo schgoo enabled auto-merge (squash) January 23, 2026 16:36
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(missing_docs)]

//! Async runtime abstractions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the rebrand to the new crate name, perhaps this should be less grand?

version = "0.1.0"
readme = "README.md"
keywords = ["oxidizer", "async", "runtime", "futures"]
categories = ["Asynchronous"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure the category slugs need to be lowervase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants