summaryrefslogtreecommitdiff
path: root/rust/src/high_level_il/operation.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-04 19:10:56 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commita826c589dfc10c542deba7ca3343a462e02d6bde (patch)
treef116254bef39f787268bbecc5eac19da310db9ce /rust/src/high_level_il/operation.rs
parent28b3c4044af06fdc32c9c85bf8381b5058306427 (diff)
[Rust] Simplify `BnStrCompatible` trait
Followup to https://github.com/Vector35/binaryninja-api/pull/5897/ This simplifies usage of the trait in user code, should just be able to `to_cstr` to get the cstr repr and then call `as_ptr`. Co-authored-by: Michael Krasnitski <michael.krasnitski@gmail.com>
Diffstat (limited to 'rust/src/high_level_il/operation.rs')
-rw-r--r--rust/src/high_level_il/operation.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/rust/src/high_level_il/operation.rs b/rust/src/high_level_il/operation.rs
index c5733a43..302a6d73 100644
--- a/rust/src/high_level_il/operation.rs
+++ b/rust/src/high_level_il/operation.rs
@@ -6,7 +6,7 @@ use super::HighLevelILLiftedInstruction;
use crate::architecture::CoreIntrinsic;
use crate::function::Function;
use crate::rc::Ref;
-use crate::string::{BnStrCompatible, BnString};
+use crate::string::{AsCStr, BnString};
use crate::variable::{ConstantData, SSAVariable, Variable};
#[derive(Clone, PartialEq, Eq)]
@@ -20,8 +20,8 @@ impl GotoLabel {
unsafe { BnString::into_string(BNGetGotoLabelName(self.function.handle, self.target)) }
}
- fn set_name<S: BnStrCompatible>(&self, name: S) {
- let raw = name.into_bytes_with_nul();
+ fn set_name<S: AsCStr>(&self, name: S) {
+ let raw = name.to_cstr();
unsafe {
BNSetUserGotoLabelName(
self.function.handle,
@@ -327,7 +327,7 @@ impl LiftedLabel {
self.target.name()
}
- pub fn set_name<S: BnStrCompatible>(&self, name: S) {
+ pub fn set_name<S: AsCStr>(&self, name: S) {
self.target.set_name(name)
}
}