From ea7a22b16fc56c23af397dd690c6c839dfb3a8f1 Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Fri, 3 May 2024 13:28:53 -0300 Subject: hide array implementation details --- rust/src/function.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'rust/src/function.rs') diff --git a/rust/src/function.rs b/rust/src/function.rs index 74e05ea5..f57d2fe3 100644 --- a/rust/src/function.rs +++ b/rust/src/function.rs @@ -414,17 +414,13 @@ unsafe impl RefCountable for Function { impl CoreArrayProvider for Function { type Raw = *mut BNFunction; type Context = (); + type Wrapped<'a> = Guard<'a, Function>; } -unsafe impl CoreOwnedArrayProvider for Function { +unsafe impl CoreArrayProviderInner for Function { unsafe fn free(raw: *mut *mut BNFunction, count: usize, _context: &()) { BNFreeFunctionList(raw, count); } -} - -unsafe impl CoreArrayWrapper for Function { - type Wrapped<'a> = Guard<'a, Function>; - unsafe fn wrap_raw<'a>(raw: &'a *mut BNFunction, context: &'a ()) -> Self::Wrapped<'a> { Guard::new(Function { handle: *raw }, context) } @@ -469,16 +465,12 @@ impl AddressRange { impl CoreArrayProvider for AddressRange { type Raw = BNAddressRange; type Context = (); + type Wrapped<'a> = &'a AddressRange; } -unsafe impl CoreOwnedArrayProvider for AddressRange { +unsafe impl CoreArrayProviderInner for AddressRange { unsafe fn free(raw: *mut Self::Raw, _count: usize, _context: &Self::Context) { BNFreeAddressRanges(raw); } -} - -unsafe impl CoreArrayWrapper for AddressRange { - type Wrapped<'a> = &'a AddressRange; - unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> { mem::transmute(raw) } -- cgit v1.3.1