Skip to content

Commit 45e8f93

Browse files
committed
[Rust] Remove duplicate (&str, Variable, &Type) named variable type impl
1 parent cf579d4 commit 45e8f93

File tree

2 files changed

+3
-31
lines changed

2 files changed

+3
-31
lines changed

rust/src/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ impl Function {
936936

937937
// TODO: Turn this into an actual type?
938938
/// List of function variables: including name, variable and type
939-
pub fn variables(&self) -> Array<(&str, Variable, &Type)> {
939+
pub fn variables(&self) -> Array<NamedVariableWithType> {
940940
let mut count = 0;
941941
let vars = unsafe { BNGetFunctionVariables(self.handle, &mut count) };
942942
assert!(!vars.is_null());

rust/src/types.rs

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,12 @@ pub struct Type {
444444
/// bv.define_user_type("int_2", &my_custom_type_2);
445445
/// ```
446446
impl Type {
447-
pub(crate) unsafe fn from_raw(handle: *mut BNType) -> Self {
447+
pub unsafe fn from_raw(handle: *mut BNType) -> Self {
448448
debug_assert!(!handle.is_null());
449449
Self { handle }
450450
}
451451

452-
pub(crate) unsafe fn ref_from_raw(handle: *mut BNType) -> Ref<Self> {
452+
pub unsafe fn ref_from_raw(handle: *mut BNType) -> Ref<Self> {
453453
debug_assert!(!handle.is_null());
454454
Ref::new(Self { handle })
455455
}
@@ -1092,34 +1092,6 @@ impl FunctionParameter {
10921092
}
10931093
}
10941094

1095-
// TODO: We need to delete this...
1096-
// Name, Variable and Type
1097-
impl CoreArrayProvider for (&str, Variable, &Type) {
1098-
type Raw = BNVariableNameAndType;
1099-
type Context = ();
1100-
type Wrapped<'a>
1101-
= (&'a str, Variable, &'a Type)
1102-
where
1103-
Self: 'a;
1104-
}
1105-
1106-
// TODO: This needs to go!
1107-
unsafe impl CoreArrayProviderInner for (&str, Variable, &Type) {
1108-
unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) {
1109-
BNFreeVariableNameAndTypeList(raw, count)
1110-
}
1111-
1112-
unsafe fn wrap_raw<'a>(
1113-
raw: &'a Self::Raw,
1114-
_context: &'a Self::Context,
1115-
) -> (&'a str, Variable, &'a Type) {
1116-
let name = CStr::from_ptr(raw.name).to_str().unwrap();
1117-
let var = Variable::from(raw.var);
1118-
let var_type = &*(raw.type_ as *mut Type);
1119-
(name, var, var_type)
1120-
}
1121-
}
1122-
11231095
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
11241096
pub struct EnumerationMember {
11251097
pub name: String,

0 commit comments

Comments
 (0)