[1/9] feat: unify GenServer with Backend enum#105
Merged
ElFantasma merged 2 commits intolambdaclass:mainfrom Jan 22, 2026
Merged
[1/9] feat: unify GenServer with Backend enum#105ElFantasma merged 2 commits intolambdaclass:mainfrom
ElFantasma merged 2 commits intolambdaclass:mainfrom
Conversation
This was referenced Jan 9, 2026
ElFantasma
reviewed
Jan 11, 2026
| type OutMsg: Send + Sized; | ||
| type Error: Debug + Send; | ||
|
|
||
| fn start(self) -> GenServerHandle<Self> { |
Collaborator
There was a problem hiding this comment.
Since Backend::Async is default, we can keep start(self) that uses that Backend internally, to avoid the breaking change.
fn start(self) -> GenServerHandle<Self> {
self.start(Backend::Async)
}
Collaborator
|
I think this PR is mostly OK, except for the deletion of the
|
ElFantasma
approved these changes
Jan 22, 2026
b7b0e6b to
75f048f
Compare
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
75f048f to
cfb1176
Compare
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
Unify the separate GenServer implementations (async/tokio and threads) into a single implementation with a
Backendenum parameter.Backend Options
Backend::Async- tokio async tasks (default, cooperative multitasking)Backend::Blocking- tokio's blocking thread pool (for blocking I/O)Backend::Thread- dedicated OS thread (for long-running singletons)Breaking Change
start()now requires aBackendargument:Changes
~650 lines (mostly deletions of duplicate code)
Test plan
🤖 Generated with Claude Code