summaryrefslogtreecommitdiff
path: root/rust/src/template_simplifier.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/template_simplifier.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/template_simplifier.rs')
-rw-r--r--rust/src/template_simplifier.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/rust/src/template_simplifier.rs b/rust/src/template_simplifier.rs
index dd815f69..57d2b0b4 100644
--- a/rust/src/template_simplifier.rs
+++ b/rust/src/template_simplifier.rs
@@ -1,16 +1,16 @@
use crate::{
- string::{BnStrCompatible, BnString},
+ string::{AsCStr, BnString},
types::QualifiedName,
};
use binaryninjacore_sys::{BNRustSimplifyStrToFQN, BNRustSimplifyStrToStr};
-pub fn simplify_str_to_str<S: BnStrCompatible>(input: S) -> BnString {
- let name = input.into_bytes_with_nul();
+pub fn simplify_str_to_str<S: AsCStr>(input: S) -> BnString {
+ let name = input.to_cstr();
unsafe { BnString::from_raw(BNRustSimplifyStrToStr(name.as_ref().as_ptr() as *mut _)) }
}
-pub fn simplify_str_to_fqn<S: BnStrCompatible>(input: S, simplify: bool) -> QualifiedName {
- let name = input.into_bytes_with_nul();
+pub fn simplify_str_to_fqn<S: AsCStr>(input: S, simplify: bool) -> QualifiedName {
+ let name = input.to_cstr();
unsafe {
QualifiedName::from_owned_raw(BNRustSimplifyStrToFQN(
name.as_ref().as_ptr() as *mut _,