summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/binaryview.rs20
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());
}
}