diff options
| author | Mason Reed <mason@vector35.com> | 2025-06-16 14:46:48 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-07-02 01:56:54 -0400 |
| commit | 00686dfc68ee40b9b7378febadf3c27eb657dff9 (patch) | |
| tree | 0d54995ab7475486732478dc87cbb306d8a2bc3e /rust | |
| parent | 93b524fbf9af52faf13b8647702f61e909b0cdf1 (diff) | |
[Rust] Remove duplicate `(&str, Variable, &Type)` named variable type impl
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/function.rs | 2 | ||||
| -rw-r--r-- | rust/src/types.rs | 32 |
2 files changed, 3 insertions, 31 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs index d126db3b..456c8f4a 100644 --- a/rust/src/function.rs +++ b/rust/src/function.rs @@ -936,7 +936,7 @@ impl Function { // TODO: Turn this into an actual type? /// List of function variables: including name, variable and type - pub fn variables(&self) -> Array<(&str, Variable, &Type)> { + pub fn variables(&self) -> Array<NamedVariableWithType> { let mut count = 0; let vars = unsafe { BNGetFunctionVariables(self.handle, &mut count) }; assert!(!vars.is_null()); diff --git a/rust/src/types.rs b/rust/src/types.rs index 03e2fc2c..ebc4328e 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -444,12 +444,12 @@ pub struct Type { /// bv.define_user_type("int_2", &my_custom_type_2); /// ``` impl Type { - pub(crate) unsafe fn from_raw(handle: *mut BNType) -> Self { + pub unsafe fn from_raw(handle: *mut BNType) -> Self { debug_assert!(!handle.is_null()); Self { handle } } - pub(crate) unsafe fn ref_from_raw(handle: *mut BNType) -> Ref<Self> { + pub unsafe fn ref_from_raw(handle: *mut BNType) -> Ref<Self> { debug_assert!(!handle.is_null()); Ref::new(Self { handle }) } @@ -1092,34 +1092,6 @@ impl FunctionParameter { } } -// TODO: We need to delete this... -// Name, Variable and Type -impl CoreArrayProvider for (&str, Variable, &Type) { - type Raw = BNVariableNameAndType; - type Context = (); - type Wrapped<'a> - = (&'a str, Variable, &'a Type) - where - Self: 'a; -} - -// TODO: This needs to go! -unsafe impl CoreArrayProviderInner for (&str, Variable, &Type) { - unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { - BNFreeVariableNameAndTypeList(raw, count) - } - - unsafe fn wrap_raw<'a>( - raw: &'a Self::Raw, - _context: &'a Self::Context, - ) -> (&'a str, Variable, &'a Type) { - let name = CStr::from_ptr(raw.name).to_str().unwrap(); - let var = Variable::from(raw.var); - let var_type = &*(raw.type_ as *mut Type); - (name, var, var_type) - } -} - #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct EnumerationMember { pub name: String, |
