Skip to content

Conversation

@unbalancedparentheses
Copy link

Summary

Simplify module structure by flattening tasks/ and removing threads/:

Changes

  • Move tasks/*.rs → root src/
  • Delete threads/ directory (replaced by Backend enum)
  • Update all imports from spawned_concurrency::tasks:: to spawned_concurrency::

New API

// Before
use spawned_concurrency::tasks::{GenServer, Backend};

// After
use spawned_concurrency::{GenServer, Backend};

~650 lines (mostly deletions)

Dependencies

⚠️ Merge after PRs #105 and #106

Test plan

  • All 24 tests pass
  • All examples compile

🤖 Generated with Claude Code

unbalancedparentheses and others added 4 commits January 9, 2026 20:39
Consolidate the two separate GenServer implementations (async/tokio and
threads) into a single implementation with a Backend enum parameter.
Breaking change: start() now requires a Backend argument:
- Backend::Async - tokio async tasks (default)
- Backend::Blocking - tokio's blocking thread pool
- Backend::Thread - dedicated OS thread
This provides runtime flexibility without code duplication, allowing
users to mix different execution backends in the same application.
- Add Backend enum to gen_server.rs
- Change start() signature to accept Backend parameter
- Update all examples and tests
- Remove thread-based example crates
Add 10 new tests covering:
- Backend enum traits (Default, Copy, Clone, Debug, PartialEq, Eq)
- All three backends handle call/cast correctly
- Backend::Thread isolates blocking work from async runtime
- Multiple backends can run concurrently with independent state
- Backend::default() works in start()
Document each backend option with:
- Comparison table showing execution model, best use cases, and limitations
- Code examples for each backend
- Detailed "When to Use" guide with advantages and avoid-when advice
- Per-variant documentation with specific use cases
Move files from tasks/ to root and remove threads/ directory:
- concurrency/src/tasks/* → concurrency/src/*
- Delete concurrency/src/threads/ (replaced by Backend enum)
- Update all imports from spawned_concurrency::tasks:: to spawned_concurrency::

The Backend enum (Async, Blocking, Thread) now provides all the
functionality previously split between tasks and threads modules,
offering a cleaner and more unified API.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ElFantasma
Copy link
Collaborator

This one is not right. See the comment in previous PR: #106 (comment)

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