summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorMark Rowe <mrowe@bdash.net.nz>2025-05-07 06:43:04 -0700
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-07 12:59:50 -0400
commit86773015c984ff1be8df8ac9b25b7f6bd2f8cca5 (patch)
treea04404414911c887f744d16aa0f3d304f01370c9 /rust/src
parentf9ac7495ac089f32b1712e5500cf2cd0c426c5dc (diff)
[Rust] Add Function::variable_type
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/function.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs
index d8b5c199..7990f109 100644
--- a/rust/src/function.rs
+++ b/rust/src/function.rs
@@ -467,6 +467,15 @@ impl Function {
}
}
+ pub fn variable_type(&self, var: &Variable) -> Option<Conf<Ref<Type>>> {
+ let raw_var = BNVariable::from(var);
+ let result = unsafe { BNGetVariableType(self.handle, &raw_var) };
+ match result.type_.is_null() {
+ false => Some(Conf::<Ref<Type>>::from_owned_raw(result)),
+ true => None,
+ }
+ }
+
pub fn high_level_il(&self, full_ast: bool) -> Result<Ref<HighLevelILFunction>, ()> {
unsafe {
let hlil_ptr = BNGetFunctionHighLevelIL(self.handle);