From f3c1a3cb3cbdd25d5f556d1ab770f8cbc29fd567 Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Tue, 16 Apr 2024 17:03:20 -0300 Subject: add guard to array with unbound return types --- rust/src/downloadprovider.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'rust/src/downloadprovider.rs') diff --git a/rust/src/downloadprovider.rs b/rust/src/downloadprovider.rs index cc243722..8334e0ce 100644 --- a/rust/src/downloadprovider.rs +++ b/rust/src/downloadprovider.rs @@ -1,5 +1,5 @@ use crate::rc::{ - Array, CoreArrayProvider, CoreArrayWrapper, CoreOwnedArrayProvider, Ref, RefCountable, + Array, CoreArrayProvider, CoreArrayWrapper, CoreOwnedArrayProvider, Guard, Ref, RefCountable, }; use crate::settings::Settings; use crate::string::{BnStrCompatible, BnString}; @@ -72,12 +72,10 @@ unsafe impl CoreOwnedArrayProvider for DownloadProvider { } unsafe impl CoreArrayWrapper for DownloadProvider { - // TODO there is nothing blocking the returned value from out-living the - // array, change it to &_ or Guard? - type Wrapped<'a> = DownloadProvider; + type Wrapped<'a> = Guard<'a, DownloadProvider>; unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> { - DownloadProvider::from_raw(*raw) + Guard::new(DownloadProvider::from_raw(*raw), &()) } } -- cgit v1.3.1