-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Approved by: @jkleinknox ============ This pr modifies the `NotificationProcessor::init` method to use `&mut self`. This allows us to consume resoruces in `self` and allows the `JoinSet` to be passed in later: ```rs pub struct StatusReporter { input_rx: Option<UnboundedReceiver<StatusInput>>, reports: Arc<Mutex<HashMap<Uuid, Status>>>, } impl NotificationProcessor<OurMessage> for StatusReporter { fn init(&mut self, join_set: &mut JoinSet<()>) -> UnboundedSender<Notification<OurMessage>> { // we consume self.input_rx and set it to `None` let rx = self.input_rx.take().expect("uninitialized input_rx"); spawn_some_other_rx(join_set, rx); self.spawn_notification_rx(join_set) } fn get_topics(&self) -> &[OurTopic] { &[OurTopic::Event] } } ```
- Loading branch information
Showing
5 changed files
with
37 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters