From a1a4d820d54607613bceb4973789b67c8c1c1232 Mon Sep 17 00:00:00 2001 From: konsti Date: Tue, 7 Jan 2025 10:55:37 +0100 Subject: [PATCH] Add `Send + 'static` bounds to cache deserialization (#10352) --- crates/uv-client/src/cached_client.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/uv-client/src/cached_client.rs b/crates/uv-client/src/cached_client.rs index dc521f5cf..3ee9e1cfc 100644 --- a/crates/uv-client/src/cached_client.rs +++ b/crates/uv-client/src/cached_client.rs @@ -40,7 +40,7 @@ pub trait Cacheable: Sized { /// /// Typical use of this is for wrapper types used to provide blanket trait /// impls without hitting overlapping impl problems. - type Target; + type Target: Send + 'static; /// Deserialize a value from bytes aligned to a 16-byte boundary. fn from_aligned_bytes(bytes: AlignedVec) -> Result; @@ -58,7 +58,7 @@ pub(crate) struct SerdeCacheable { inner: T, } -impl Cacheable for SerdeCacheable { +impl Cacheable for SerdeCacheable { type Target = T; fn from_aligned_bytes(bytes: AlignedVec) -> Result { @@ -79,7 +79,7 @@ impl Cacheable for SerdeCacheable { /// All `OwnedArchive` values are cacheable. impl Cacheable for OwnedArchive where - A: rkyv::Archive + for<'a> rkyv::Serialize>, + A: rkyv::Archive + for<'a> rkyv::Serialize> + Send + 'static, A::Archived: rkyv::Portable + rkyv::Deserialize + for<'a> rkyv::bytecheck::CheckBytes>, @@ -214,7 +214,7 @@ impl CachedClient { /// allowed to make subsequent requests, e.g. through the uncached client. #[instrument(skip_all)] pub async fn get_serde< - Payload: Serialize + DeserializeOwned + 'static, + Payload: Serialize + DeserializeOwned + Send + 'static, CallBackError: std::error::Error + 'static, Callback, CallbackReturn, @@ -342,7 +342,7 @@ impl CachedClient { /// Make a request without checking whether the cache is fresh. pub async fn skip_cache< - Payload: Serialize + DeserializeOwned + 'static, + Payload: Serialize + DeserializeOwned + Send + 'static, CallBackError: std::error::Error + 'static, Callback, CallbackReturn, @@ -569,7 +569,7 @@ impl CachedClient { /// Perform a [`CachedClient::get_serde`] request with a default retry strategy. #[instrument(skip_all)] pub async fn get_serde_with_retry< - Payload: Serialize + DeserializeOwned + 'static, + Payload: Serialize + DeserializeOwned + Send + 'static, CallBackError: std::error::Error + 'static, Callback, CallbackReturn, @@ -648,7 +648,7 @@ impl CachedClient { /// /// See: pub async fn skip_cache_with_retry< - Payload: Serialize + DeserializeOwned + 'static, + Payload: Serialize + DeserializeOwned + Send + 'static, CallBackError: std::error::Error + 'static, Callback, CallbackReturn,