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/backgroundtask.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'rust/src/backgroundtask.rs') diff --git a/rust/src/backgroundtask.rs b/rust/src/backgroundtask.rs index 26480e7e..451ecd07 100644 --- a/rust/src/backgroundtask.rs +++ b/rust/src/backgroundtask.rs @@ -99,16 +99,18 @@ unsafe impl RefCountable for BackgroundTask { } } -unsafe impl CoreOwnedArrayProvider for BackgroundTask { +impl CoreArrayProvider for BackgroundTask { type Raw = *mut BNBackgroundTask; type Context = (); +} +unsafe impl CoreOwnedArrayProvider for BackgroundTask { unsafe fn free(raw: *mut *mut BNBackgroundTask, count: usize, _context: &()) { BNFreeBackgroundTaskList(raw, count); } } -unsafe impl<'a> CoreOwnedArrayWrapper<'a> for BackgroundTask { +unsafe impl<'a> CoreArrayWrapper<'a> for BackgroundTask { type Wrapped = Guard<'a, BackgroundTask>; unsafe fn wrap_raw( -- cgit v1.3.1