summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-10-28 21:17:30 -0400
committerMason Reed <mason@vector35.com>2024-10-28 21:21:55 -0400
commit690c8b92d5605332f2d7a6b5d138b1eccc69fbce (patch)
tree9dc2cf6dc8e07f79be7ee8d9564b6132713c744b
parent8dabdd428acd30aac4ebb7e17270505fc3ba4a59 (diff)
Rust: Fix cloning module workflows
-rw-r--r--rust/src/workflow.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/rust/src/workflow.rs b/rust/src/workflow.rs
index 246571a8..12253644 100644
--- a/rust/src/workflow.rs
+++ b/rust/src/workflow.rs
@@ -280,7 +280,7 @@ impl Workflow {
///
/// * `name` - the name for the new [Workflow]
#[must_use]
- pub fn new_from_copy<S: BnStrCompatible>(name: S) -> Workflow {
+ pub fn new_from_copy<S: BnStrCompatible + Clone>(name: S) -> Workflow {
Self::new_from_copy_with_root(name, "")
}
@@ -289,21 +289,20 @@ impl Workflow {
/// * `name` - the name for the new [Workflow]
/// * `root_activity` - perform the clone operation with this activity as the root
#[must_use]
- pub fn new_from_copy_with_root<S: BnStrCompatible, A: IntoActivityName>(
+ pub fn new_from_copy_with_root<S: BnStrCompatible + Clone, A: IntoActivityName>(
name: S,
root_activity: A,
) -> Workflow {
- let name = name.into_bytes_with_nul();
+ let raw_name = name.clone().into_bytes_with_nul();
let activity = root_activity.activity_name();
// I can't think of a single reason as to why we should let users pass a workflow handle into this.
- // TODO: [Default] Workflow::Instance() called without specifying a workflow name. Defaulting to 'core.function.defaultAnalysis'.
- // To prevent warning being emitted we default to `core.function.defaultAnalysis`.
- let placeholder_workflow = Workflow::instance("core.function.defaultAnalysis");
+ // To prevent warning being emitted we default to the name.
+ let placeholder_workflow = Workflow::instance(name);
unsafe {
Self::from_raw(
NonNull::new(BNWorkflowClone(
placeholder_workflow.handle.as_ptr(),
- name.as_ref().as_ptr() as *const c_char,
+ raw_name.as_ref().as_ptr() as *const c_char,
activity.as_ref().as_ptr() as *const c_char,
))
.unwrap(),