From bc9409ea1295b7a8c1ddef1f61ebdda411fe0022 Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 17 Apr 2025 20:11:07 +0000 Subject: [PATCH] [spr] initial version Created using spr 1.3.6-beta.1 --- src/saga_exec.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/saga_exec.rs b/src/saga_exec.rs index 112813d..bbcabf5 100644 --- a/src/saga_exec.rs +++ b/src/saga_exec.rs @@ -2029,7 +2029,7 @@ impl<'a> PrintOrderer<'a> { } } -/// Return true if all neighbors of `node_id` in the given `direction` +/// Return true if all neighbors of `node_id` in the given `direction` /// return true for the predicate `test`. fn neighbors_all( graph: &Graph, @@ -2176,6 +2176,20 @@ impl ActionContext { pub fn user_data(&self) -> &UserType::ExecContextType { &self.user_context } + + /// Maps the user data for this action into a new context type + pub fn map_user_data(self, f: F) -> ActionContext + where + F: FnOnce(Arc) -> Arc, + { + ActionContext { + ancestor_tree: self.ancestor_tree, + node_id: self.node_id, + dag: self.dag, + user_context: f(self.user_context), + saga_params: self.saga_params, + } + } } /// Converts a NodeIndex (used by the graph representation to identify a node)