Make the Type trait cloneable as its contained deep in nested structs 2021-03-java-bindings-base
authorMatt Corallo <git@bluematt.me>
Fri, 24 Sep 2021 18:44:32 +0000 (18:44 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 4 Apr 2022 18:10:07 +0000 (18:10 +0000)
lightning/src/ln/wire.rs

index e7db446a86f17f036ceeccba9aca52c4aa7ea652..405dfa9d4c83502770b9a6f2dff05fc136e9a0f9 100644 (file)
@@ -255,12 +255,12 @@ pub(crate) use self::encode::Encode;
 /// Defines a type identifier for sending messages over the wire.
 ///
 /// Messages implementing this trait specify a type and must be [`Writeable`].
-pub trait Type: core::fmt::Debug + Writeable {
+pub trait Type: core::fmt::Debug + Writeable + Clone {
        /// Returns the type identifying the message payload.
        fn type_id(&self) -> u16;
 }
 
-impl<T: core::fmt::Debug + Writeable> Type for T where T: Encode {
+impl<T: core::fmt::Debug + Writeable + Clone> Type for T where T: Encode {
        fn type_id(&self) -> u16 {
                T::TYPE
        }
@@ -548,7 +548,7 @@ mod tests {
                }
        }
 
-       #[derive(Eq, PartialEq, Debug)]
+       #[derive(Clone, Eq, PartialEq, Debug)]
        struct TestCustomMessage {}
 
        const CUSTOM_MESSAGE_TYPE : u16 = 9000;