January 2019
Intermediate to advanced
520 pages
14h 32m
English
The following message type is necessary to subscribe or unsubscribe from RepeaterUpdate messages. Add the following enumeration:
pub enum RepeaterControl { Subscribe(Recipient<RepeaterUpdate>), Unsubscribe(Recipient<RepeaterUpdate>),}
It has two variants with the same Recipient<RepeaterUpdate> type inside. Actors will send their own Recipient addresses to start listening for updates or to stop any notifications about new comments.
Implement the Message trait for the RepeaterControl struct to turn it into the message type and use an empty Result associated type:
impl Message for RepeaterControl { type Result = ();}
Now, we can implement a Handler trait for the RepeaterControl message:
impl Handler<RepeaterControl> for RepeaterActor ...
Read now
Unlock full access