summaryrefslogtreecommitdiff
path: root/rust/src/binaryview.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-10-19 19:12:30 -0400
committerMason Reed <mason@vector35.com>2024-10-19 19:12:30 -0400
commite7895a2c36189bc1c3010a48b47656e861607640 (patch)
treebdcc1d48479e5431e2d46e65f0e0a6f045acd3e5 /rust/src/binaryview.rs
parent8850303573a90898ec56706767a9ae7ece810f26 (diff)
Add way to set the id of the defined type in rust api
Diffstat (limited to 'rust/src/binaryview.rs')
-rw-r--r--rust/src/binaryview.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs
index f1006d57..f04d7da5 100644
--- a/rust/src/binaryview.rs
+++ b/rust/src/binaryview.rs
@@ -620,6 +620,25 @@ pub trait BinaryViewExt: BinaryViewBase {
QualifiedName(name_handle)
}
+ fn define_auto_type_with_id<S: BnStrCompatible>(
+ &self,
+ name: S,
+ id: S,
+ type_obj: &Type,
+ ) -> QualifiedName {
+ let mut qualified_name = QualifiedName::from(name);
+ let id_str = id.into_bytes_with_nul();
+ let name_handle = unsafe {
+ BNDefineAnalysisType(
+ self.as_ref().handle,
+ id_str.as_ref().as_ptr() as *const _,
+ &mut qualified_name.0,
+ type_obj.handle,
+ )
+ };
+ QualifiedName(name_handle)
+ }
+
fn define_user_type<S: BnStrCompatible>(&self, name: S, type_obj: &Type) {
let mut qualified_name = QualifiedName::from(name);
unsafe {