From 1948cf197775c8b734417f97f99ef8939aeb29dc 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 92561585d..7edd4befd 100644 --- a/src/producer/base_producer.rs +++ b/src/producer/base_producer.rs @@ -639,7 +639,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, @@ -772,6 +771,16 @@ where } } +impl Clone for ThreadedProducer { + fn clone(&self) -> Self { + Self { + producer: Arc::clone(&self.producer), + should_stop: Arc::clone(&self.should_stop), + handle: self.handle.clone(), + } + } +} + impl Drop for ThreadedProducer where Part: Partitioner,