From be6936a53ddaa68fee404d24c96aa9c6ffbfee3d Mon Sep 17 00:00:00 2001 From: Michael Krasnitski Date: Sun, 12 May 2024 22:55:18 -1000 Subject: [PATCH] Rust: change signatures of `define_{auto,user}_data_var` --- rust/src/binaryview.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs index 33be62d9b..aed2a454a 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>>(&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>>(&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()); } }