From 8705ac9f442bb5e6e85dab1077514f45fd904a11 Mon Sep 17 00:00:00 2001 From: Petros Angelatos Date: Thu, 3 Oct 2024 19:16:52 +0300 Subject: [PATCH] relax clone trait bound on context Signed-off-by: Petros Angelatos --- src/producer/base_producer.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/producer/base_producer.rs b/src/producer/base_producer.rs index cf7f30cde..643b6c6f4 100644 --- a/src/producer/base_producer.rs +++ b/src/producer/base_producer.rs @@ -494,7 +494,6 @@ where /// queued events, such as delivery notifications. The thread will be /// automatically stopped when the producer is dropped. #[must_use = "The threaded producer will stop immediately if unused"] -#[derive(Clone)] pub struct ThreadedProducer where C: ProducerContext + 'static, @@ -623,6 +622,16 @@ where } } +impl Clone for ThreadedProducer { + fn clone(&self) -> Self { + Self { + producer: self.producer.clone(), + should_stop: Arc::clone(&self.should_stop), + handle: self.handle.clone(), + } + } +} + impl Drop for ThreadedProducer where C: ProducerContext + 'static,