]> git.lizzy.rs Git - mt_rudp.git/blobdiff - src/common.rs
Implement clone for RudpSender
[mt_rudp.git] / 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> {