diff options
Diffstat (limited to 'rust/src/workflow.rs')
| -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 { |
