diff --git a/src/future/entry_selector.rs b/src/future/entry_selector.rs index 641a5f29..b38d1c73 100644 --- a/src/future/entry_selector.rs +++ b/src/future/entry_selector.rs @@ -238,6 +238,21 @@ where .await } + pub async fn and_try_compute_if_nobody_else( + self, + f: F, + ) -> Result, E> + where + F: FnOnce(Option>) -> Fut, + Fut: Future, E>>, + E: Send + Sync + 'static, + { + let key = Arc::new(self.owned_key); + self.cache + .try_compute_if_nobody_else_with_hash_and_fun(key, self.hash, f) + .await + } + /// Performs an upsert of an [`Entry`] by using the given closure `f`. The word /// "upsert" here means "update" or "insert". ///