]> git.lizzy.rs Git - mt_rudp.git/commitdiff
Implement clone for RudpSender
authorLizzy Fleckenstein <eliasfleckenstein@web.de>
Thu, 16 Feb 2023 16:16:55 +0000 (17:16 +0100)
committerLizzy Fleckenstein <eliasfleckenstein@web.de>
Thu, 16 Feb 2023 16:32:23 +0000 (17:32 +0100)
src/common.rs

index b888ed769c148c9754f6340ffc932bb1799a93a4..4c0bc08600af0ee038ea9f65e15bf1291310a125 100644 (file)
@@ -69,6 +69,15 @@ pub struct RudpSender<S: UdpSender> {
     pub(crate) share: Arc<RudpShare<S>>,
 }
 
+// derive(Clone) adds unwanted Clone trait bound to S parameter
+impl<S: UdpSender> Clone for RudpSender<S> {
+    fn clone(&self) -> Self {
+        Self {
+            share: Arc::clone(&self.share),
+        }
+    }
+}
+
 macro_rules! impl_share {
     ($T:ident) => {
         impl<S: UdpSender> $T<S> {