From 181ad567199e5685578ecf7ad400257098c2e175 Mon Sep 17 00:00:00 2001 From: Fabian Freyer Date: Mon, 31 Jan 2022 06:24:07 +0100 Subject: rust: add ArrayGuard and for non-owned arrays To make use of shard functionality, we split the CoreOwnedArrayProvider into CoreArrayProvider and CoreOwnedArrayProvider. Array makes use of the CoreOwnedArrayProvider, which depends on CoreArrayProvider, while the new ArrayGuard only requires CoreArrayProvider and represents a non-owned array. --- rust/src/symbol.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'rust/src/symbol.rs') diff --git a/rust/src/symbol.rs b/rust/src/symbol.rs index c545d962..28e655e0 100644 --- a/rust/src/symbol.rs +++ b/rust/src/symbol.rs @@ -257,16 +257,18 @@ unsafe impl RefCountable for Symbol { } } -unsafe impl CoreOwnedArrayProvider for Symbol { +impl CoreArrayProvider for Symbol { type Raw = *mut BNSymbol; type Context = (); +} +unsafe impl CoreOwnedArrayProvider for Symbol { unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { BNFreeSymbolList(raw, count); } } -unsafe impl<'a> CoreOwnedArrayWrapper<'a> for Symbol { +unsafe impl<'a> CoreArrayWrapper<'a> for Symbol { type Wrapped = Guard<'a, Symbol>; unsafe fn wrap_raw(raw: &'a Self::Raw, context: &'a Self::Context) -> Self::Wrapped { -- cgit v1.3.1