From b47f34b2c82e1829d03f327bdcd602a83ae5e08b Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Fri, 14 Jun 2024 14:17:15 -0300 Subject: implement rust Component --- rust/src/types.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'rust/src/types.rs') diff --git a/rust/src/types.rs b/rust/src/types.rs index 9b2271d5..8fab75dc 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -1339,6 +1339,24 @@ impl ToOwned for Type { } } +pub struct ComponentReferencedTypes; +impl CoreArrayProvider for ComponentReferencedTypes{ + type Raw= *mut BNType; + type Context= (); + type Wrapped<'a> = &'a Self; +} + +unsafe impl CoreArrayProviderInner for ComponentReferencedTypes{ + unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { + BNComponentFreeReferencedTypes(raw, count) + } + + unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> { + // SAFETY: BNType and Type are trasparent + core::mem::transmute(raw) + } +} + /////////////////////// // FunctionParameter -- cgit v1.3.1