1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
//! Broadcast router. akka.net: `Routing/BroadcastPool.cs`. use crate::actor::ActorRef; pub struct BroadcastRouter<M: Send + Clone + 'static> { routees: Vec<ActorRef<M>>, } impl<M: Send + Clone + 'static> BroadcastRouter<M> { pub fn new(routees: Vec<ActorRef<M>>) -> Self { Self { routees } } pub fn route(&self, msg: M) { for r in &self.routees { r.tell(msg.clone()); } } }