Skip to content

feat(anyspawn): allow creating spawner using tokio handle#341

Merged
martintmk merged 5 commits intomainfrom
spawner-with-tokio-handle
Mar 26, 2026
Merged

feat(anyspawn): allow creating spawner using tokio handle#341
martintmk merged 5 commits intomainfrom
spawner-with-tokio-handle

Conversation

@martintmk
Copy link
Member

Enables explicitly passing tokio handle when creating Spawner. Used for scenarios where tokio runtime is explicitly created and then spawning is done through Spawner even from places where Tokio context is not initialized on the thread (interop).

Copilot AI review requested due to automatic review settings March 26, 2026 09:49
@codecov
Copy link

codecov bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (8b9c195) to head (8f6c540).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #341   +/-   ##
=======================================
  Coverage   100.0%   100.0%           
=======================================
  Files         210      210           
  Lines       15540    15553   +13     
=======================================
+ Hits        15540    15553   +13     

☔ 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support in anyspawn for constructing spawners/builders with an explicit tokio::runtime::Handle, enabling task spawning from threads without an ambient Tokio runtime context (interop scenarios).

Changes:

  • Extend Spawner’s Tokio implementation to optionally store a tokio::runtime::Handle and use it for spawning when provided.
  • Add Spawner::new_tokio_with_handle and CustomSpawnerBuilder::tokio_with_handle constructors.
  • Update crate docs/feature lists (including README content) to mention the new constructor(s).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

File Description
crates/anyspawn/src/spawner.rs Store optional Tokio Handle in the Tokio spawner kind and add new_tokio_with_handle; spawn via handle when present.
crates/anyspawn/src/builder.rs Add CustomSpawnerBuilder::tokio_with_handle to build custom spawners backed by a provided Tokio handle.
crates/anyspawn/src/lib.rs Update feature documentation to mention the new Tokio-handle constructor.
crates/anyspawn/README.md Update generated README feature list/links to reference the new constructor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 26, 2026 10:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martintmk martintmk force-pushed the spawner-with-tokio-handle branch from b06ba76 to b9b1b82 Compare March 26, 2026 10:22
Copilot AI review requested due to automatic review settings March 26, 2026 10:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martintmk martintmk enabled auto-merge (squash) March 26, 2026 13:43
@martintmk martintmk merged commit 85ef2c7 into main Mar 26, 2026
27 checks passed
@martintmk martintmk deleted the spawner-with-tokio-handle branch March 26, 2026 14:26
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.

4 participants