[3/9] refactor: flatten module structure#107
Closed
unbalancedparentheses wants to merge 5 commits intolambdaclass:mainfrom
Closed
[3/9] refactor: flatten module structure#107unbalancedparentheses wants to merge 5 commits intolambdaclass:mainfrom
unbalancedparentheses wants to merge 5 commits intolambdaclass:mainfrom
Conversation
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>
This was referenced Jan 9, 2026
Collaborator
|
This one is not right. See the comment in previous PR: #106 (comment) |
Collaborator
|
Closing this PR as it incorrectly deletes the threads/ module, assuming tasks and threads GenServers are the same (they are not - tasks uses async/Tokio while threads uses sync/OS threads). We will reimplement the module structure improvements while preserving both tasks/ and threads/ modules. See the consolidated plan for v0.5 development. |
This was referenced Jan 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Simplify module structure by flattening tasks/ and removing threads/:
Changes
tasks/*.rs→ rootsrc/threads/directory (replaced by Backend enum)spawned_concurrency::tasks::tospawned_concurrency::New API
~650 lines (mostly deletions)
Dependencies
Test plan
🤖 Generated with Claude Code