Skip to content

Conversation

@MegaRedHand
Copy link
Contributor

@MegaRedHand MegaRedHand commented Jul 21, 2025

This PR removes the state parameter of the GenServer trait to use self instead. This reduces the number of types required to add a new GenServer, but imposes more constraints on the whole GenServer (before we had two "states": the GenServer implementor, with Sync constraint; and the GenServer::State type, with Clone constraint, now we only have the second one).

@juan518munoz juan518munoz marked this pull request as ready for review July 22, 2025 14:44
const TIMEOUT_DURATION: Duration = Duration::from_millis(100);

#[derive(Default)]
#[derive(Debug, Default, Clone)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Default is no longer needed, right?


impl GenServer for SomeTask {
type CallMsg = SomeTaskCallMsg;
type CastMsg = ();
Copy link
Collaborator

@ElFantasma ElFantasma Jul 22, 2025

Choose a reason for hiding this comment

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

Not part of this PR, but maybe we can move all these () to Unused 👉 👈?

Copy link
Collaborator

@ElFantasma ElFantasma left a comment

Choose a reason for hiding this comment

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

Nice!

@juan518munoz juan518munoz merged commit 25dd9ca into main Jul 22, 2025
3 checks passed
@juan518munoz juan518munoz deleted the unify-self-and-state branch July 22, 2025 18:10
github-merge-queue bot pushed a commit to lambdaclass/ethrex that referenced this pull request Jul 23, 2025
**Motivation**

Update Spawned to accomodate new Actor interface.

**Description**

Since [spawned `0.2.0`](lambdaclass/spawned#35)
the state and GenServer is "the same".
pedrobergamini pushed a commit to pedrobergamini/ethrex that referenced this pull request Aug 24, 2025
**Motivation**

Update Spawned to accomodate new Actor interface.

**Description**

Since [spawned `0.2.0`](lambdaclass/spawned#35)
the state and GenServer is "the same".
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.

5 participants