summaryrefslogtreecommitdiff
path: root/rust/src/workflow.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-03 23:15:17 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commit6264254065bbae9d89f51cf3330379b7ace09592 (patch)
tree9ece1d1739215c2faef2d808ef4fdc019ad527fa /rust/src/workflow.rs
parentc3fdda9727f5507818e3f55576ad32215a22b0f9 (diff)
[Rust] Return `String` instead of `BnString` for cases where lossy conversion can be tolerated
Still need to go and audit all usage, but realistically the most important places to give the user control are with symbols, where the data can come from non utf8 sources This is still incomplete, I just looked for usage of -> BnString so any other variant was omitted.
Diffstat (limited to 'rust/src/workflow.rs')
-rw-r--r--rust/src/workflow.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/rust/src/workflow.rs b/rust/src/workflow.rs
index ca42ff68..71a60824 100644
--- a/rust/src/workflow.rs
+++ b/rust/src/workflow.rs
@@ -204,10 +204,10 @@ impl Activity {
unsafe { Activity::ref_from_raw(NonNull::new(result).unwrap()) }
}
- pub fn name(&self) -> BnString {
+ pub fn name(&self) -> String {
let result = unsafe { BNActivityGetName(self.handle.as_ptr()) };
assert!(!result.is_null());
- unsafe { BnString::from_raw(result) }
+ unsafe { BnString::into_string(result) }
}
}
@@ -303,10 +303,10 @@ impl Workflow {
unsafe { Array::new(result, count, ()) }
}
- pub fn name(&self) -> BnString {
+ pub fn name(&self) -> String {
let result = unsafe { BNGetWorkflowName(self.handle.as_ptr()) };
assert!(!result.is_null());
- unsafe { BnString::from_raw(result) }
+ unsafe { BnString::into_string(result) }
}
/// Register this [Workflow], making it immutable and available for use.
@@ -382,7 +382,7 @@ impl Workflow {
}
/// Retrieve the configuration as an adjacency list in JSON for the [Workflow].
- pub fn configuration(&self) -> BnString {
+ pub fn configuration(&self) -> String {
self.configuration_with_activity("")
}
@@ -390,7 +390,7 @@ impl Workflow {
/// [Workflow], just for the given `activity`.
///
/// `activity` - return the configuration for the `activity`
- pub fn configuration_with_activity<A: BnStrCompatible>(&self, activity: A) -> BnString {
+ pub fn configuration_with_activity<A: BnStrCompatible>(&self, activity: A) -> String {
let result = unsafe {
BNWorkflowGetConfiguration(
self.handle.as_ptr(),
@@ -398,7 +398,7 @@ impl Workflow {
)
};
assert!(!result.is_null());
- unsafe { BnString::from_raw(result) }
+ unsafe { BnString::into_string(result) }
}
/// Whether this [Workflow] is registered or not. A [Workflow] becomes immutable once registered.