diff options
| author | Michael Krasnitski <michael.krasnitski@gmail.com> | 2024-05-12 22:55:18 -1000 |
|---|---|---|
| committer | Kyle Martin <krm504@nyu.edu> | 2024-05-15 14:02:24 -0400 |
| commit | be6936a53ddaa68fee404d24c96aa9c6ffbfee3d (patch) | |
| tree | e6ccc453ca878f41a77774ad764ef1da8a811d2b /rust/src/binaryview.rs | |
| parent | 3037596e9489f75929454cda082bedbd163d9129 (diff) | |
Rust: change signatures of `define_{auto,user}_data_var`
Diffstat (limited to 'rust/src/binaryview.rs')
| -rw-r--r-- | rust/src/binaryview.rs | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs index 33be62d9..aed2a454 100644 --- a/rust/src/binaryview.rs +++ b/rust/src/binaryview.rs @@ -49,7 +49,9 @@ use crate::segment::{Segment, SegmentBuilder}; use crate::settings::Settings; use crate::symbol::{Symbol, SymbolType}; use crate::tags::{Tag, TagType}; -use crate::types::{DataVariable, NamedTypeReference, QualifiedName, QualifiedNameAndType, Type}; +use crate::types::{ + Conf, DataVariable, NamedTypeReference, QualifiedName, QualifiedNameAndType, Type, +}; use crate::Endianness; use crate::rc::*; @@ -550,24 +552,16 @@ pub trait BinaryViewExt: BinaryViewBase { } } - fn define_auto_data_var(&self, dv: &DataVariable) { + fn define_auto_data_var<'a, T: Into<Conf<&'a Type>>>(&self, addr: u64, ty: T) { unsafe { - BNDefineDataVariable( - self.as_ref().handle, - dv.address(), - &mut dv.type_with_confidence().into(), - ); + BNDefineDataVariable(self.as_ref().handle, addr, &mut ty.into().into()); } } /// You likely would also like to call [`Self::define_user_symbol`] to bind this data variable with a name - fn define_user_data_var(&self, dv: &DataVariable) { + fn define_user_data_var<'a, T: Into<Conf<&'a Type>>>(&self, addr: u64, ty: T) { unsafe { - BNDefineUserDataVariable( - self.as_ref().handle, - dv.address(), - &mut dv.type_with_confidence().into(), - ); + BNDefineUserDataVariable(self.as_ref().handle, addr, &mut ty.into().into()); } } |
