Reputation: 21
I need to send the same message object to other actors. It will be very costly to clone it each time. And it shouldn't actually be necessary. And I get the error as expected. "value moved here, in previous iteration of loop".
Passing parameters with & does not work. I couldn't do it with Weak
/ Arc
reference. Actix does not seem to support it (Weak/Arc message).
How could it be the best solution for this case?
let myMessageObject: MyMessageType = MyMessageType {};
for user in self.users.iter() {
user.Addr.do_send(myMessageObject);
}
impl Handler<MyMessageType> for User {
type Result = ();
fn handle(&mut self, setStartMessage: MyMessageType, ctx: &mut ws::WebsocketContext<Self>) {
}
}
Upvotes: 2
Views: 697