Skip to content

feat: add spawn! macro to simplify creation of tasks - #27

Merged
SeaRoll merged 1 commit into
masterfrom
feat-simple-spawn
Jan 26, 2026
Merged

feat: add spawn! macro to simplify creation of tasks#27
SeaRoll merged 1 commit into
masterfrom
feat-simple-spawn

Conversation

@SeaRoll

@SeaRoll SeaRoll commented Jan 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

@SeaRoll
SeaRoll requested a review from Copilot January 25, 2026 23:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new spawn! macro that simplifies task spawning by eliminating the need for explicit error handling. The macro panics when the task queue is full, making it suitable for scenarios where queue overflow is unexpected. The existing spawn_task! macro is retained for cases requiring error handling.

Changes:

  • Added new spawn! macro that panics on spawn failure instead of returning a Result
  • Updated spawn_task! macro documentation to clarify when to use each macro variant
  • Migrated all examples and tests from spawn_task! to the simpler spawn! macro

Reviewed changes

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

Show a summary per file
File Description
src/lib.rs Adds spawn! macro, updates spawn_task! documentation, and converts tests to use new macro
examples/yield.rs Converts from spawn_task! with explicit error handling to spawn! macro
examples/time.rs Converts from spawn_task! with explicit error handling to spawn! macro
examples/simple.rs Converts from spawn_task! with explicit error handling to spawn! macro
examples/interval.rs Converts from spawn_task! with explicit error handling to spawn! macro
examples/channels.rs Converts from spawn_task! with explicit error handling to spawn! macro

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

Comment thread src/lib.rs
Comment thread src/lib.rs
@SeaRoll
SeaRoll merged commit d6f77c0 into master Jan 26, 2026
4 checks passed
@SeaRoll
SeaRoll deleted the feat-simple-spawn branch January 26, 2026 06:58
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.

2 participants