Skip to content

Commit

Permalink
Add Send markers to Manager types
Browse files Browse the repository at this point in the history
This fixes #318
  • Loading branch information
bikeshedder committed May 4, 2024
1 parent eb6db64 commit 61d7cde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/managed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ pub type RecycleResult<E> = Result<(), RecycleError<E>>;
/// 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<Output = Result<Self::Type, Self::Error>>;
fn create(&self) -> impl Future<Output = Result<Self::Type, Self::Error>> + Send;

/// Tries to recycle an instance of [`Manager::Type`].
///
Expand All @@ -106,7 +106,7 @@ pub trait Manager: Sync + Send {
&self,
obj: &mut Self::Type,
metrics: &Metrics,
) -> impl Future<Output = RecycleResult<Self::Error>>;
) -> impl Future<Output = RecycleResult<Self::Error>> + Send;

/// Detaches an instance of [`Manager::Type`] from this [`Manager`].
///
Expand Down

0 comments on commit 61d7cde

Please sign in to comment.