Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiver<M> support #198

Closed
axos88 opened this issue Dec 7, 2022 · 7 comments
Closed

Receiver<M> support #198

axos88 opened this issue Dec 7, 2022 · 7 comments

Comments

@axos88
Copy link

axos88 commented Dec 7, 2022

Hi!

Is this a fork of actix with real async support? Seems to have a very similar api and feature set. One thing I'm missing is the receiver trait, which allows addresses to different actors that handle a specific message to be stored in a heterogenous list.

This would probably need moving the return type of the handler implementation to M: Message, which makes more sense, since currently it would be possible that two different actors return different types for the same message.

@axos88
Copy link
Author

axos88 commented Dec 7, 2022

Ah I think message channel is that I'm looking for. Any reason this is a struct and not a trait?

@thomaseizinger
Copy link
Collaborator

Ah I think message channel is that I'm looking for. Any reason this is a struct and not a trait?

See #102. It ends up being a cleaner API and allowed us to implement broadcasting for them.

@thomaseizinger
Copy link
Collaborator

thomaseizinger commented Dec 7, 2022

Is this a fork of actix with real async support?

It started as a fork yes but the codebases have massively diverged since.

We:

  • don't have any unsafe code
  • have a much smaller codebase and API surface
  • got runtime-agnostic async support with proper backpressure

:)

@thomaseizinger
Copy link
Collaborator

This would probably need moving the return type of the handler implementation to M: Message, which makes more sense, since currently it would be possible that two different actors return different types for the same message.

This used to be the case and we moved away from it because it is a really quirky API. Any type can be a message now and what type to return is defined in the Handler impl on an actor. This makes a lot more sense given that the Handler impl itself defines the functionality, hence it should also say what that functionality evaluates too.

@thomaseizinger
Copy link
Collaborator

This would probably need moving the return type of the handler implementation to M: Message, which makes more sense, since currently it would be possible that two different actors return different types for the same message.

This used to be the case and we moved away from it because it is a really quirky API. Any type can be a message now and what type to return is defined in the Handler impl on an actor. This makes a lot more sense given that the Handler impl itself defines the functionality, hence it should also say what that functionality evaluates too.

It also enables #111 cleanly which we can hopefully ship some day :)

@axos88
Copy link
Author

axos88 commented Dec 7, 2022

Thanks for the thorough answers. I did put my sherlock hat on, and found that it is still possible to put multiple actors that handle a specific message onto a collection as long as they return the same type as answers.

@thomaseizinger
Copy link
Collaborator

Thanks for the thorough answers. I did put my sherlock hat on, and found that it is still possible to put multiple actors that handle a specific message onto a collection as long as they return the same type as answers.

Glad you got it sorted!

Is there anything else or can we close this issue? :)

@axos88 axos88 closed this as completed Dec 8, 2022
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

No branches or pull requests

2 participants