From: Matt Corallo Date: Fri, 24 Sep 2021 18:44:32 +0000 (+0000) Subject: Make the Type trait cloneable as its contained deep in nested structs X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=refs%2Fheads%2F2021-03-java-bindings-base;p=rust-lightning Make the Type trait cloneable as its contained deep in nested structs --- diff --git a/lightning/src/ln/wire.rs b/lightning/src/ln/wire.rs index e7db446a8..405dfa9d4 100644 --- a/lightning/src/ln/wire.rs +++ b/lightning/src/ln/wire.rs @@ -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 Type for T where T: Encode { +impl 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;