Skip to content

Commit 1948cf1

Browse files
committed
relax clone trait bound on context
Signed-off-by: Petros Angelatos <[email protected]>
1 parent 99bd070 commit 1948cf1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/producer/base_producer.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,6 @@ where
639639
/// queued events, such as delivery notifications. The thread will be
640640
/// automatically stopped when the producer is dropped.
641641
#[must_use = "The threaded producer will stop immediately if unused"]
642-
#[derive(Clone)]
643642
pub struct ThreadedProducer<C, Part: Partitioner = NoCustomPartitioner>
644643
where
645644
C: ProducerContext<Part> + 'static,
@@ -772,6 +771,16 @@ where
772771
}
773772
}
774773

774+
impl<C: ProducerContext + 'static> Clone for ThreadedProducer<C> {
775+
fn clone(&self) -> Self {
776+
Self {
777+
producer: Arc::clone(&self.producer),
778+
should_stop: Arc::clone(&self.should_stop),
779+
handle: self.handle.clone(),
780+
}
781+
}
782+
}
783+
775784
impl<C, Part> Drop for ThreadedProducer<C, Part>
776785
where
777786
Part: Partitioner,

0 commit comments

Comments
 (0)