Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/saga_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F>(
graph: &Graph<InternalNode, ()>,
Expand Down Expand Up @@ -2176,6 +2176,20 @@ impl<UserType: SagaType> ActionContext<UserType> {
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<F, U: SagaType>(self, f: F) -> ActionContext<U>
where
F: FnOnce(Arc<UserType::ExecContextType>) -> Arc<U::ExecContextType>,
{
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)
Expand Down
Loading