Skip to content

Impl PartialEq, Eq, Hash for ActorRef#368

Merged
slawlor merged 1 commit intoslawlor:mainfrom
realchonk:traits
Aug 4, 2025
Merged

Impl PartialEq, Eq, Hash for ActorRef#368
slawlor merged 1 commit intoslawlor:mainfrom
realchonk:traits

Conversation

@realchonk
Copy link
Copy Markdown
Contributor

No description provided.

@slawlor
Copy link
Copy Markdown
Owner

slawlor commented Jul 15, 2025

Why would you wan to do this? ActorId's exist for actor matching purposes, you shouldn't match on the full ActorRef ideally or use it as a key in a hash map

Copy link
Copy Markdown
Owner

@slawlor slawlor left a comment

Choose a reason for hiding this comment

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

We need a reasoning why this is necessary here.

@realchonk
Copy link
Copy Markdown
Contributor Author

Sorry, in some project I store a list of attached ActorRef<Msg>s and a "sender" ActorRef<Msg>.
Then I have the following functions:

  • reply(Msg) to send the message to sender
  • broadcast(Msg) to send the message to all attached Actors
  • and broadcast_except_sender(Msg)

For broadcast_except_sender(Msg) I have to do something like this:

for a in all_actors {
  if a.get_cell() != sender.get_cell() {
    // send
  }
}

I would like to be able to omit the .get_cell().

Sorry for the delay and not being able to be more specific,
as it's a work-related project.

@realchonk
Copy link
Copy Markdown
Contributor Author

Previously I was also storing the actors in a HashSet, that's why I added the Hash derive.

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 4, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.40%. Comparing base (9d77eca) to head (63fb425).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ractor/src/actor/actor_ref.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #368      +/-   ##
==========================================
- Coverage   82.44%   82.40%   -0.04%     
==========================================
  Files          71       71              
  Lines       12891    12897       +6     
==========================================
  Hits        10628    10628              
- Misses       2263     2269       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@slawlor slawlor merged commit b667085 into slawlor:main Aug 4, 2025
18 of 20 checks passed
@realchonk realchonk deleted the traits branch August 4, 2025 19:02
@realchonk
Copy link
Copy Markdown
Contributor Author

thanks!

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