slawlor / ractor

Rust actor framework
MIT License
1.52k stars 73 forks source link

As a subscriber, I should can subscribe multiple type of messages from publisher #244

Closed FancyQian closed 5 months ago

FancyQian commented 5 months ago

Describe the bug As a subscriber, I can subscribe to multiple types of messages from the publisher

Additional context There are two examples of Port

  1. https://github.com/slawlor/ractor/blob/main/ractor/examples/output_port.rs
  2. https://docs.rs/ractor/latest/ractor/port/output/type.OutputPortSubscriber.html#example

I am not sure how to start with my implementation, I want to subscribe to multiple messages from publisher. Many thanks, I'm a newbie, and maybe I didn't study your code thoroughly, but a better example would make it easier for everyone to get started because 2 different examples make me a little confused.

FancyQian commented 5 months ago

It seems that the subscribe message must impl From trait, but in my case, the publisher pubs the message to the subsribler directly, is it possible with the current code?

FancyQian commented 5 months ago

well, it can be done by filtering message enum type.