diff options
| author | Brian Potchik <brian@vector35.com> | 2025-03-06 19:54:50 -0500 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2025-03-06 19:54:50 -0500 |
| commit | ef97d4703cfd08a4ccc3c00dac7cf84877875245 (patch) | |
| tree | d8687be219e325cd619ada7acfaf694a6627af1c /rust/src | |
| parent | 5192206454838298978583761915446906174711 (diff) | |
Add API to insert Activities after a specified Activity.
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/workflow.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/rust/src/workflow.rs b/rust/src/workflow.rs index e95beb48..dcc388d9 100644 --- a/rust/src/workflow.rs +++ b/rust/src/workflow.rs @@ -529,6 +529,34 @@ impl Workflow { } } + /// Insert the list of `activities` after the specified `activity` and at the same level. + /// + /// * `activity` - the Activity node for which to insert `activities` after + /// * `activities` - the list of Activities to insert + pub fn insert_after<A, I>(&self, activity: A, activities: I) -> bool + where + A: BnStrCompatible, + I: IntoIterator, + I::Item: BnStrCompatible, + { + let input_list: Vec<_> = activities + .into_iter() + .map(|a| a.into_bytes_with_nul()) + .collect(); + let mut input_list_ptr: Vec<*const _> = input_list + .iter() + .map(|x| x.as_ref().as_ptr() as *const c_char) + .collect(); + unsafe { + BNWorkflowInsertAfter( + self.handle.as_ptr(), + activity.into_bytes_with_nul().as_ref().as_ptr() as *const c_char, + input_list_ptr.as_mut_ptr(), + input_list.len(), + ) + } + } + /// Remove the specified `activity` pub fn remove<A: BnStrCompatible>(&self, activity: A) -> bool { unsafe { |
