summaryrefslogtreecommitdiff
path: root/rust/src/workflow.rs
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2025-03-06 19:54:50 -0500
committerBrian Potchik <brian@vector35.com>2025-03-06 19:54:50 -0500
commitef97d4703cfd08a4ccc3c00dac7cf84877875245 (patch)
treed8687be219e325cd619ada7acfaf694a6627af1c /rust/src/workflow.rs
parent5192206454838298978583761915446906174711 (diff)
Add API to insert Activities after a specified Activity.
Diffstat (limited to 'rust/src/workflow.rs')
-rw-r--r--rust/src/workflow.rs28
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 {