diff options
Diffstat (limited to 'rust/src/template_simplifier.rs')
| -rw-r--r-- | rust/src/template_simplifier.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/rust/src/template_simplifier.rs b/rust/src/template_simplifier.rs new file mode 100644 index 00000000..dd815f69 --- /dev/null +++ b/rust/src/template_simplifier.rs @@ -0,0 +1,20 @@ +use crate::{ + string::{BnStrCompatible, 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(); + 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(); + unsafe { + QualifiedName::from_owned_raw(BNRustSimplifyStrToFQN( + name.as_ref().as_ptr() as *mut _, + simplify, + )) + } +} |
