diff --git a/src/backoff.rs b/src/backoff.rs index 09412b05..afec84f2 100644 --- a/src/backoff.rs +++ b/src/backoff.rs @@ -85,9 +85,9 @@ impl Backoff { /// Perform an async operation that retries with a backoff pub async fn backy_offy(&mut self, request_name: &str, do_stuff: F) -> B where - F: Fn() -> F1, - F1: std::future::Future>, - C: core::fmt::Display, + F: (Fn() -> F1) + Send + Sync, + F1: std::future::Future> + Send, + C: core::fmt::Display + Send, { loop { let e = match do_stuff().await { diff --git a/src/connection.rs b/src/connection.rs index f7bc4721..2cc7f7b7 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -181,8 +181,8 @@ impl Connect for MessengerTransport { } #[async_trait] -trait ArbitraryBrokerCache { - type C: Connect; +trait ArbitraryBrokerCache: Send + Sync { + type C: Connect + Send + Sync; async fn get(&self) -> Result>; @@ -282,7 +282,7 @@ mod tests { use crate::protocol::api_key::ApiKey; use std::sync::atomic::{AtomicBool, Ordering}; - struct FakeBroker(Box Result + Sync>); + struct FakeBroker(Box Result + Send + Sync>); impl FakeBroker { fn success() -> Self {