From 0d25d76becc2ddeb8f2a03ab37eb4ba49a65efef Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sat, 8 Jan 2022 15:26:34 +0100 Subject: [PATCH] Split out (internal) on_facet_stop from on_stop --- syndicate/src/actor.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/syndicate/src/actor.rs b/syndicate/src/actor.rs index e62b49d..230ae44 100644 --- a/syndicate/src/actor.rs +++ b/syndicate/src/actor.rs @@ -837,7 +837,15 @@ impl<'activation> Activation<'activation> { /// terminates cleanly, `action` will be called in the context of the facet's parent. See /// also notes against [`on_stop_notify`][Activation::on_stop_notify]. pub fn on_stop ActorResult>(&mut self, action: F) { - if let Some(f) = self.active_facet() { + self.on_facet_stop(self.facet.facet_id, action) + } + + fn on_facet_stop ActorResult>( + &mut self, + facet_id: FacetId, + action: F, + ) { + if let Some(f) = self.state.get_facet(facet_id) { f.stop_actions.push(Box::new(action)); } }