From 61d7cde8d9ed1e4035cac03a22cdc2229f862057 Mon Sep 17 00:00:00 2001 From: "Michael P. Jung" Date: Sat, 4 May 2024 08:30:56 +0000 Subject: [PATCH] Add Send markers to Manager types This fixes #318 --- CHANGELOG.md | 3 +++ src/managed/mod.rs | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ceecf76..cbe1ec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Add `Send` to `Manager::Type` and `Manager::Error` associated types +- Add `Send` to `Manager::create` and `Manager::recycle` return types + ## [0.11.2] - 2024-04-10 - Make `Timeouts::new` and `Timeouts::wait_millis` functions const fns diff --git a/src/managed/mod.rs b/src/managed/mod.rs index 6fed815..2d4464d 100644 --- a/src/managed/mod.rs +++ b/src/managed/mod.rs @@ -89,13 +89,13 @@ pub type RecycleResult = Result<(), RecycleError>; /// Manager responsible for creating new [`Object`]s or recycling existing ones. pub trait Manager: Sync + Send { /// Type of [`Object`]s that this [`Manager`] creates and recycles. - type Type; + type Type: Send; /// Error that this [`Manager`] can return when creating and/or recycling /// [`Object`]s. - type Error; + type Error: Send; /// Creates a new instance of [`Manager::Type`]. - fn create(&self) -> impl Future>; + fn create(&self) -> impl Future> + Send; /// Tries to recycle an instance of [`Manager::Type`]. /// @@ -106,7 +106,7 @@ pub trait Manager: Sync + Send { &self, obj: &mut Self::Type, metrics: &Metrics, - ) -> impl Future>; + ) -> impl Future> + Send; /// Detaches an instance of [`Manager::Type`] from this [`Manager`]. ///