feat(anyspawn): allow creating spawner using tokio handle#341
feat(anyspawn): allow creating spawner using tokio handle#341
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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 atokio::runtime::Handleand use it for spawning when provided. - Add
Spawner::new_tokio_with_handleandCustomSpawnerBuilder::tokio_with_handleconstructors. - 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.
There was a problem hiding this comment.
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.
b06ba76 to
b9b1b82
Compare
There was a problem hiding this comment.
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.
Enables explicitly passing tokio handle when creating
Spawner. Used for scenarios where tokio runtime is explicitly created and then spawning is done throughSpawnereven from places where Tokio context is not initialized on the thread (interop).